How do I configure Visual Studio Code
VScode keeps giving same output from my first line of code
I create new Python file hello.py
I type the following code
print("hello")
the output is
hello
but when I type another code
print("Hello World!")
the output is still the same
hello
3
Answers
According to the image you provided, you didnt save the changes you made to file. You can see that with that white circle on top of the file name. So just save the changes with CTRL + S and everything should be fine
As Hamidou mentioned in another answer, the problem is because you did not save the file. If you want to save the file whenever you make changes, you can turn on the auto save function by clicking auto save under
File> auto save
Obviously you didn’t save the file after modifying it, and the white dot next to the file name indicates this information.
Press Ctrl+S to save the file, then execute the script.
Or add the following setting to enable autosave.
Also you are using Code Runner to execute code, which is not recommended. If you still want to use it, the following setting save the script before running the code (only for Code Runner).