Activity 2.16
Source Code
import random
import math
def main():
done = False
while not done:
print("Menu System")
print("E1 - Example 1")
print("E2 - Example 2")
print("E3 - Example 3")
print("Q - Quit")
choice = input("Choice: ").upper()
if choice == "E1":
print("Example 1")
# example1 function call
elif choice == "E2":
print("Example 2")
# function calls
elif choice == "E3":
print("Example 3")
# example3 function call
elif choice == "Q":
print("Quitting!")
done = True
else:
print("Invalid choice")
# example1 function definition
def example1():
print("Programs must be written for people to read,")
print("and only incidentally for machines to execute.")
print("-- Hal Abelson")
# example3 function definition
# problem1 function definition
# problem 2 function definition
# problem 3 function definition
# call the main function, do not delete!
main()
Last updated