Answer to Question #280019 in Python for zarbaab

Question #280019

write a program which takes a number from the user if the number is not equal to 200, it asks the user to enter 4 more numbers and displays the result after subtracting the first 2 numbers and dividing the last 2 numbers.


1
Expert's answer
2021-12-15T16:23:23-0500
# Python 3.9.5

number_1 = int(input('Enter number: '))

if number_1 != 200:
    i = 0
    while i < 4:
        number_2 = int(input('Enter number: '))
        if i < 2:
            number_1 = number_1 - number_2
        else:
            number_1 = number_1 / number_2
        i += 1
    print(number_1)
else: 
    print(number_1)

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