Activity 2.28
Source Code
import math
import random
def main():
done = False
while not done:
print("Menu System")
print("E1 - Example 1")
print("Q - Quit")
choice = input("Choice: ").upper()
if choice == "E1":
example1()
elif choice == "P1":
problem1()
elif choice == "P2":
problem2()
elif choice == "P3":
problem3()
elif choice == "P4":
problem4()
elif choice == "P5":
problem5()
elif choice == "P6":
problem6()
elif choice == "P7":
problem7()
elif choice == "P8":
problem8()
elif choice == "P9":
problem9()
elif choice == "P10":
problem10()
elif choice == "Q":
print("Quitting!")
done = True
else:
print("Invalid choice")
# example1 function definition
def example1():
print("Example 1")
# nested dictionary
students = {
"Alice": {"age": 15, "shop": "Biotech"},
"Riley": {"age": 17, "shop": "Auto"},
"Sam": {"age": 16, "shop": "Computer Science"}
}
# accessing a student's age
# accessing a student's shop
# modify a student's shop
# add a new student
# delete a student
# iterate through a nested dictionary
# problem1
def problem1():
pass # remove
# problem2
def problem2():
pass # remove
# problem3
def problem3():
pass # remove
# problem4
def problem4():
pass # remove
# problem5
def problem5():
pass # remove
# problem6
def problem6():
pass # remove
# problem7
def problem7():
pass # remove
# problem8
def problem8():
pass # remove
# problem9
def problem9():
pass # remove
# problem10
def problem10():
pass # remove
# call the main function, do not delete!
main()
Last updated