Answer to Question #273931 in Python for Alice

Question #273931

Create a python code of this output

Choices:

a. Calculator

b. Odd or Even

c. Positive or Negative Number

Enter your choice: c

Enter a number: -6

-6 is a negative number.


1
Expert's answer
2021-12-02T00:35:43-0500


SOLUTION CODE


print("\nChoices")
print("\na. Calculator")
print("b. Odd or Even")
print("c. positive or Negative")

choice = input("\nEnter your choice: ")
if choice == "a":
    print("\n1. Multiplication")
    print("2. Division")
    my_cal_choice = int(input("Enter the operation to perform: "))
    if my_cal_choice == 1:
        first_number = int(input("Enter the first number: "))
        second_number = int(input("Enter the second number: "))
        print("The product of "+str(first_number+ " and "+str(second_number)+" = "+str(first_number*second_number)))
    elif my_cal_choice == 2:
        first_number = int(input("Enter the first number: "))
        second_number = int(input("Enter the second number: "))
        print("The quotient of "+str(first_number+ " and "+str(second_number)+" = "+str(first_number/second_number)))
    else:
        print("Inavlid option please try again")
if choice=="b":
    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 == "c"):
    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")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS