Activity 2.21
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("P1 - Problem 1")
print("Q - Quit")
choice = input("Choice: ").upper()
if choice == "E1":
# example1 function call
example1()
elif choice == "E2":
# example2 function call
example2()
elif choice == "P1":
print("Problem 1")
# problem1 function call
elif choice == "P2":
print("Problem 2")
# problem2 function call
elif choice == "P3":
print("Problem 3")
# problem3 function call
elif choice == "P4":
print("Problem 4")
# problem4 function call
elif choice == "P5":
print("Problem 5")
# problem5 function call
elif choice == "Q":
print("Quitting!")
done = True
else:
print("Invalid choice")
# example1 function definition
def example1():
print("Example 1")
# create a list of the first 10 numbers
# print the index and values
# remove the last element
# remove the second element
# remove the value 5
# example2 function definition
def example2():
print("Example 2")
# create a list
# print the index and values
# count 1's, 2's, 3's
# sort the list in ascending order
# sort the list in desending order
# problem1 function definition
# problem2 function definition
# problem3 function definition
# problem4 function definition
# problem5 function definition
# call the main function, do not delete!
main()
Last updated