[Python] How to run a Python file in Visual Studio code from the terminal?

Discussão em 'Python' iniciado por Stack, Abril 20, 2025.

  1. Stack

    Stack Membro Participativo

    I have tried to run a pretty simple code

    x = input("What's x? ")
    y = input("What's y? ")

    z= int(x) + int(y)

    print (z)



    But, when I try to run that code from the terminal writing "name_of_the_file.py", I find this error:

    "The term "name_of_the_file.py" is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

    If a right click on where you write the code, and then click on "run python file in terminal", it runs!

    I am taking the CS50P, and I see that this should be possible because the teacher is able to do that. What am I doing wrong guys?

    Continue reading...

Compartilhe esta Página