May-21-2024, 03:30 PM
(May-21-2024, 02:56 PM)CandleType1a Wrote:(May-21-2024, 02:48 PM)deanhystad Wrote: The next line after an "if" must be indented one level. Not doing so is a syntax error.
You normally don't type code like this in python. Normally you write code to a file and pass the filename as an argument to python.
myscript.py
x = 5 if x < 10: print("Smaller") # Must indent + 1 level if x > 20: # Must indent -1 level print("Bigger") print("finis")
Hiya, thanks for the reply,
Sorry, I had indented after the ifs, but it didn't show up that way when I pasted it into here. Unfortunately, the issue is persisting though, I tried using your code in Python, and as the attached screenshot shows, exact same issue is still ocurring.
So, am I not supposed to be typing directly into Python? I downloaded it and have been using it directly when working through several tutorials, but I've noticed that more than a few things I've been trying simply aren't working even when I'm using the same code shown on in tutorials. I just assumed I was supposed to be typing directly into the command prompt thing.