create a python program
Choices:
a. Calculator
b. Odd or Even
c. Positive or Negative Number Enter your choice: a Enter first number: 10 Enter second number: 5 The sum of 10 and 5 is 15 The difference of 10 and 5 is 5 The product of 10 and 5 is 50 The quotient of 10 and 5 is 2
ch=""
while ch!="e":
print("a. Calculator")
print("b. Odd or Even")
print("c. Positive or Negative Number")
print("e. Exit")
ch=input()
if ch.lower()=="a":
number1=int(input("Enter first number: "))
number2=int(input("Enter second number: "))
sumResult=number1+number2
differenceResult=number1-number2
productResult=number1*number2
quotientResult=number1/number2
print(f"The sum of {number1} and {number2} is {sumResult}")
print(f"The difference of {number1} and {number2} is {differenceResult}")
print(f"The product of {number1} and {number2} is {productResult}")
print(f"The quotient of {number1} and {number2} is {quotientResult}")
elif ch.lower()=="b":
number=int(input("Enter a number: "))
if number%2==0:
print("Number is Even")
else:
print("Number is Odd")
elif ch.lower()=="c":
number=int(input("Enter a number: "))
if number>0:
print("Number is Positive")
else:
print("Number is Negative")
elif ch.lower()=="e":
pass
else:
print("Wrong menu item")
Comments
Leave a comment