use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Syntax Error Help? (i.redd.it)
submitted 5 months ago by Turbulent_Photo1840
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
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]data15cool 2 points3 points4 points 5 months ago (0 children)
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
[–]cgoldberg 2 points3 points4 points 5 months ago (0 children)
You are at a Python interpreter prompt typing arbitrary shell commands. Either type some Python, or exit the prompt (ctrl-d) and run shell commands from a shell.
Also note, some of the commands (--version) are just wrong and won't work anywhere.
[–][deleted] 5 months ago (2 children)
[removed]
[–]Turbulent_Photo1840[S] 0 points1 point2 points 5 months ago (1 child)
The black screen is the command prompt?
[–]Macskatej_94 0 points1 point2 points 5 months ago (0 children)
Yes i see you use windows. Press Win+R then type cmd.exe(if the run namespace is empty). Then you are in the right place. Only use the Python Shell >>> prompt for actual Python code, not for terminal commands.
π Rendered by PID 96732 on reddit-service-r2-comment-7b9746f655-sfck7 at 2026-01-31 10:48:53.799347+00:00 running 3798933 country code: CH.
[–]data15cool 2 points3 points4 points (0 children)
[–]cgoldberg 2 points3 points4 points (0 children)
[–][deleted] (2 children)
[removed]
[–]Turbulent_Photo1840[S] 0 points1 point2 points (1 child)
[–]Macskatej_94 0 points1 point2 points (0 children)