Create a python code about this
Choices:
a. Calculator
b. Odd or Even
c. Positive or Negative Number Enter your choice: b Enter a number: 80 80 is an even number.
SOLUTION CODE
print("\nChoices")
print("\na. Odd or Even")
print("b. positive or Negative")
choice = input("\nEnter your choice: ")
if choice=="a":
number = int(input("\nEnter a number: "))
if number % 2 == 0:
print(str(number)+" is an even number")
else:
print(str(number) + " is an odd number")
elif(choice == "b"):
number = int(input("\nEnter a number: "))
if number == 0:
print("The number you have entered is a zero")
elif number > 0:
print(str(number) + " is a positive number")
else:
print(str(number) + " is a negative number")
else:
print("Invalid choice, please try again")
Comments
Leave a comment