Main Loop

[Back] <- - + - -> [Next]

A main loop can be created by placing the existing code in a while statement.
All lines of the original code are indented by 4 more spaces.
An extra print statement has been added at the beginning to improve appearance.
while True:              ### Note the capital 'T' and : (colon)
    print                ### This is the only other new line
    print 'Menu'
    print '===='
    # previous code
    if option == 'a':
        print 'You selected "a"'
    # previous code
    else:
        print 'Invalid choice - try again'

The body of the program will work exactly the same as before.
But, now after a choice has been handled, the menu is re-displayed.
A further choice can be made and so on.
Close the window (top-right X-button) to end the program.