Answer to Question #267127 in Python for Matteo Villamor

Question #267127



if op == 0:


print("Thank you for using our calculator!")


if op == 1:


first = int(input("Give the first value: "))


second = int(input("Give the second value: "))


result = first + second


print("1. Addition")


print(result)


if op == 2:


first = int(input("Give the first value: "))


second = int(input("Give the second value: "))


result = first - second


print("2. Subtraction")


print(result)


if op == 3:


first = int(input("Give the first value: "))


second = int(input("Give the second value: "))


result = first / second


print("3. Multiplication")


print(result)


if op == 4:


first = int(input("Give the first value: "))


second = int(input("Give the second value: "))


result = first * second


print("4. Division")


print(result)



Question:


1. In this program, you are going to create a with getter and setter.

1
Expert's answer
2021-11-19T07:53:03-0500


while(True):
    print("Enter 1 for Addition  ")
    print("Enter 2 for Subtraction ")
    print("Enter 3 for Multiplication  ")
    print("Enter 3 for Division ")
    print("Enter 0 for exit")
    op = int(input("Enter your choice : "))
    if op == 0:
    
        print("Thank you for using our calculator!")
        break
    
    if op == 1:
    
        first = int(input("Give the first value: "))
        second = int(input("Give the second value: "))
        result = first + second
    
        print("1. Addition")
        print(result)
    
    if op == 2:
        first = int(input("Give the first value: "))
        second = int(input("Give the second value: "))
        result = first - second
        print("2. Subtraction")
        print(result)
    
    if op == 3:
        first = int(input("Give the first value: "))
        second = int(input("Give the second value: "))
        result = first / second
        print("3. Multiplication")
        print(result)
    
    if op == 4:
        first = int(input("Give the first value: "))
        second = int(input("Give the second value: "))
        result = first * second
        print("4. Division")
        print(result)
            
            

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