0

I'm starting to learn programming now, and it's my first time in this forum :)

I'm doing this Udemy course, and the teacher is showing how to use the Terminal. I have the exact same code as his, but still, when I run the code in the terminal, it's not showing the results. Instead, it's opening the Windows CMD. Image

This print is right after I ran the code. According to the course, it should show the "print" in the terminal. But instead of that, it's only opening and closing the CMD, not showing anything in the terminal. It mai be a very simple thing, but I'm not finding. Could anyone help me on this?

Sorry fot my bad English. I'm still learning. I decied to use the English page, so maybe I can learn more English at the same time as programming :D

Should show the result in the terminal. But it's only opening the CMD.

  • To run python scripts, you should call the python interpreter and provide the file name/path as an argument. I see you just have the file path in your cmd. In visual studio code you can just right click somewhere in editor and chose 'run python file in terminal', if you have the python extension installed. – practical-plankton Nov 04 '22 at 09:06

1 Answers1

0

TLDR: To run a python script, python your-script.

Python is both an interpreter and a compiler due to the implementation (depending on how you look at it). You can read more here.

As your script is not compiled ahead of time, CMD does not know how to execute your file.

Therefore, you need to call python to interprete your script.

ytan11
  • 908
  • 8
  • 18