1. a.
Develop a python program to read 2 numbers from the keyboard and perform the
arithmetic operations based on the choice. (1-Add, 2-Subtract, 3-Multiply, 4-Divide)
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
print("\nChoose an operation:")
print("1. Add")
print("2. Subtract")
print("3. Multiply")
print("4. Divide")
choice = int(input("Enter your choice (1-4): "))
if choice == 1:
result = num1 + num2
print("The sum is:", result)
elif choice == 2:
result = num1 - num2
print("The difference is:",result)
elif choice == 3:
result = num1 * num2
print("The product is:",result)
elif choice == 4:
if num2 != 0: # to avoid divide by zero error
result = num1 / num2
print("The division is:",result)
else:
print("Error! Division by zero is not allowed.")
else:
print("Invalid choice! Please enter a number between 1 and 4.")