r/PythonLearning • • Aug 09 '25

Syntax Error Help?

Post image

Followed along on the first video on YouTube with Corey Schafer. I don’t know what I’m doing wrong. I added the code in Idle and I keep getting this. Sorry for ignorance, I have no scripting background at all

0 Upvotes

5 comments sorted by

View all comments

3

u/data15cool Aug 09 '25

I think what’s happened here is that you were trying to get the version of your Python installation with ‘python —version’ but you must’ve pressed enter after typing ‘python’ instead of the full command

What this does is takes you into the Python “shell” which is where you can run Python code. Now you’re typing ‘—version’ and Python doesn’t know what that is (for a number of reasons) and causing errors.

Type ‘exit()’ to get back to the terminal prompt and run the full command

Edit: same for the subsequent commands, you’re trying to run your Python script from within the Python shell rather than the terminal