Python, writing multi line code in IDLE

Himanshu.MarJAVA picture Himanshu.MarJAVA · May 2, 2012 · Viewed 31.4k times · Source

How do i write

   >>> x = int(raw_input("Please enter an integer: "))
    >>> if x < 0:
    ...      x = 0
    ...      print 'Negative changed to zero'
    ... elif x == 0:
    ...      print 'Zero'
    ... elif x == 1:
    ...      print 'Single'
    ... else:
    ...      print 'More'
    ...

this in IDLE. As soon as I hit enter after writting first line, it executes the first line and i am not able to write full code. I am very new to python, just started it today. Any help will be appreciated.

Answer

Aligus picture Aligus · May 2, 2012

Try File => New Window in top menu. Then write your code in this windows and run it by F5 key (or Run in top menu)