Activity 2.12
Source Code
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 == "Q":
print("Quitting!")
done = True
else:
print("Invalid choice")
# example1 function definition
def example1():
print("Example 1")
# declare a 2D list
# call print_matrix function
# modify an element
# call print_matrix function (again)
def print_matrix(matrix):
# iterate over each element
for row in matrix:
for element in row:
print(element, end=" ")
print()
# problem1
def problem1():
pass
# problem2
def problem2():
pass
# problem3
def problem3():
pass
# problem4
def problem4():
pass
# call the main function, do not delete!
main()
Last updated