I start learning about python, so i read the tutorial:
they show this:

>>> x = int(raw_input("Please enter an integer: "))
Please enter an integer: 42
>>> if x < 0:
... x = 0
... print 'Negative changed to zero'
... elif x == 0:
... print 'Zero'
... elif x == 1:
... print 'Single'
... else:
... print 'More'
but i dont know how to get the elif indent!!!
can anyone help me? I use python 2.6 GUI.
bissically when I press the tab button, it indents to the print statement, but not where I can put elif. TY

8 Years
Discussion Span
Last Post by breatheasier

u need to press backspace button before entering elif. In this case carret will be put at the beginning of python shell and you can type elif.


Just press space 4 times, then you have it indented the right amount. Do this for all of them, not the actual if statement but the stuff afterwards.

>>>if stuff == True:
...     print "stuff" #i pressed space 4 times
... else:
...     print 'no'

My advice, don't use the Python Shell for programming, use an editor. The Python Shell interative interpreter is only for very short tests. It is basically there to confuse beginners and discourage them from using Python. :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.