Q2A
Q2A
return a + b
while True:
print("\nMenu:")
print("1. Addition")
print("2. Subtraction")
print("3. Multiplication")
print("4. Division")
print("5. Exit")
if choice == '5':
print("Exiting program...")
break
if choice == '1':
print("Result:", add(a,b))
elif choice == '2':
print("Result:", subtract(a,b))
elif choice == '3':
print("Result:", multiply(a,b))
elif choice == '4':
print("Result:", divide(a,b))
else:
print("Invalid choice")
*********OUTPUT**********
Menu:
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exit
Enter your choice (1-5): 1
Enter first number: 12
Enter second number: 13
Result: 25
Menu:
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exit
Enter your choice (1-5): 2
Enter first number: 34
Enter second number: 45
Result: -11
Menu:
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exit
Enter your choice (1-5): 5
Exiting program...