Answer to Question #155814 in Python for Diana

Question #155814

Currently, this program will add 6 and 3 together, output the math problem and output the answer. Edit this code so that a random number is generated from 1 - 10 (inclusive) for the variables a and b. Also, instead of adding the two numbers together, the edited program should multiply them, and output the proper math problem and answer. Be sure to update every line of code to reflect the changes needed.


1
Expert's answer
2021-01-15T11:22:48-0500
import random 
a = random.random()
b = random.random()
# since random give number between 0 and 1
# To get number between 1 and 10, simply multipy by 10
# so product will be multiplied by 100
print(100*a*b)










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