Activity 1.27
Source Code
import random
def main():
done = False
while not done:
print("Menu System")
print("E1 - Example 1")
print("P1 - Problem 1")
print("P2 - Problem 2")
print("P3 - Problem 3")
print("P4 - Problem 4")
print("Q - Quit")
choice = input("Choice: ")
if choice == "E1":
# example1 function call
example1()
elif choice == "P1":
print("Problem 1")
elif choice == "P2":
print("Problem 2")
elif choice == "P3":
print("Problem 3")
elif choice == "P4":
print("Problem 4")
elif choice == "Q":
print("Quitting!")
done = True
else:
print("Invalid choice")
# example1 function definition
def example1():
print("Example 1")
# numbers list
# print the first number
# print the last number
# print the numbers using a C-style loop
# print the numbers using for in loop
# problem1 function definition
# problem2 function definition
# problem3 function definition
# problem4 function definition
# call the main function, do not delete!
main()
Last updated