Question

Ask the user for 2 numbers in Python Output the sum, product, quotient and difference of...

Ask the user for 2 numbers in Python
Output the sum, product, quotient and difference of the numbers in Python

0 0
Add a comment Improve this question Transcribed image text
Answer #1

PROGRAM


# Prompt user to enter 2 numbers and then store the input in variables
num1 = input('Enter number 1 : ')
num2 = input('Enter number 2 : ')

print('-------------------------------------')

# Add and print ouput
sum = int(num1) + int(num2)
print('The sum is {0}'.format(sum))

# multiply and print ouput
product = int(num1) * int(num2)
print('The product is {0}'.format(product))

# divide and print ouput
quotient = int(num1) / int(num2)
print('The quotient is {0}'.format(quotient))

# subtract and print ouput
diff = int(num1) - int(num2)
print('The difference is {0}'.format(diff))

OUTPUT

Add a comment
Know the answer?
Add Answer to:
Ask the user for 2 numbers in Python Output the sum, product, quotient and difference of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT