Skip to content

Instantly share code, notes, and snippets.

@gtalarico
Created June 22, 2016 03:04
Show Gist options
  • Save gtalarico/06d18487c3a883b326dd7a1b839e6ec2 to your computer and use it in GitHub Desktop.
Save gtalarico/06d18487c3a883b326dd7a1b839e6ec2 to your computer and use it in GitHub Desktop.
def function1():
"""Description of Function 1."""
pass
def funciton2():
"""Description of Function 2."""
pass
def function3():
"""Description of Function 3."""
pass
def menu_exit():
"""Exit the program."""
sys.exit()
menu = (
('1', function1),
('2', function1),
('3', function1),
('4', function1),
)
menu = OrderedDict(menu)
if __name__ == '__main__':
while True:
print('='*30)
print('Program Name')
print('='*30)
for n, func in menu.items():
print('{0} - {1}'.format(n, func.__doc__))
selection = input('Select an option:')
try:
menu[selection]()
except KeyError:
print('Invalid Option')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment