#!/usr/bin/python # Version 1 ## Show menu ## print (30 * '-') print (" M A I N - M E N U") print (30 * '-') print ("1. Backup") print ("2. User management") print ("3. Reboot the server") print (30 * '-') ## Get input ### choice = raw_input('Enter your choice [1-3] : ') ### Convert string to int type ## choice = int(choice) ### Take action as per selected menu-option ### if choice == 1: print ("Starting backup...") elif choice == 2: print ("Starting user management...") elif choice == 3: print ("Rebooting the server...") else: ## default ## print ("Invalid number. Try again...")
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question