Alex Rivera | Logout

Writing multi-line code in Python's IDLE application

Asked 2012-05-02T12:21:40.857
15

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 is in IDLE. As soon as I hit Enter after writting first line, it executes the first line and I am not able to write the full code.

Edit
Report

1 Answer

15

Try menu File → New File in the top menu. Then write your code in this window and run it by the F5 key (or Run in the top menu).

answered 2012-05-02T12:23:14.543

Your Answer