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

Recommended Answers

All 5 Replies

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. :)

yeah i m using wordpad now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.