1. a.
Develop a python program to read 2 numbers from the keyboard and perform the basic arithmetic
operations based on the choice. (1-Add, 2-Subtract, 3-Multiply, 4-Divide).
# Program to perform basic arithmetic operations
# Read two numbers from the user
num1 = int(input("Enter the first number: "))
num2 = int(input("Enter the second number: "))
# Display menu of operations
print("\nChoose an operation:")
print("1. Add")
print("2. Subtract")
print("3. Multiply")
print("4. Divide")
# Read user choice
choice = int(input("Enter your choice (1-4): "))
# Perform the operation
if choice == 1:
result = num1 + num2
print("The result of addition is:",result)
elif choice == 2:
result = num1 - num2
print(f"The result of subtraction is: {result}")
elif choice == 3:
result = num1 * num2
print(f"The result of multiplication is: {result}")
elif choice == 4:
if num2 != 0:
result = num1 / num2
print(f"The result of division is: {result}")
else:
print("Error: Division by zero is not allowed.")
else:
print("Invalid choice! Please enter a number between 1 and 4.")
1 b. Develop a program to read the name and year of birth of a person. Display whether the person is a
senior citizen or not.
name=input('Enter your name:')
born_year= int(input('Enter your born year:'))
current_year=2025
age=current_year-born_year
if age>=60:
print('Senior citizen')
else:
print('not a senior citizen')