Cannot run updated file from terminal of VSC, for Python

Question:

So to make it very simple.

If I write print("Hello World") and run it on the RUN icon on top right corner it works perfectly fine.
And only then if I type in terminal python hello.py executes again just fine.

But if I change program to print("Hello to everybody") and I type in terminal python hello.py it executes the previous program and giving me Hello World on screen. But then again if I click on run icon and after correct execution repeat in terminal python hello.py, now it runs correctly.

Well I tried CTRL,SHift P, to change terminal and like select interpreter but couldn’t figure out from which file is it trying to start program. And why is it correct after I use run icon.

Asked By: Ivan Mikuličin

||

Answers:

Are you saving the file after changing it? The Run button will run the code that is currently in the editor, while running it via python in the command line will run it from the saved file.

Answered By: JRiggles

Thanks, it helped.

Apparently just needed to turn autosave on.

Sorry for such trivial question, I am very new at this.

Answered By: Ivan Mikuličin