William Peck
asked on
newbie syntax question for Python - indenting
Looking at Python for the first time … going through these tutorials
I'm running Python via SPSS Statistics (Python 3.4.3 Shell) and got this error which is entered directly from the tutorial:
In Anaconda I get this error:
So not sure what I'm doing wrong right out of the gate ...
Also, is there a recommended IDE for Python?
I'm running Python via SPSS Statistics (Python 3.4.3 Shell) and got this error which is entered directly from the tutorial:
>>> x = int(input("Please enter an integer: "))
Please enter an integer: 55
>>> if x < 0:
x = 0
print('Negative changed to zero')
elif x == 0:
SyntaxError: invalid syntax
>>>
In Anaconda I get this error:
>>> x = int(input("Please enter an integer: "))
Please enter an integer: 55
>>> if x < 0:
... x = 0
File "<stdin>", line 2
x = 0
^
IndentationError: expected an indented block
>>>
And if I press the Indent key, Anancoda throws up on me ...So not sure what I'm doing wrong right out of the gate ...
Also, is there a recommended IDE for Python?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
thanks! Yes, I figured out about spacing and not tabs … but thanks, especially for the coding/IDE tips.