Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Say any 3 numbers could be picked, each being between 1 and 80, as long as the n

ID: 3541868 • Letter: S

Question

Say any 3 numbers could be picked, each being between 1 and 80, as long as the numbers met 2 user specifications. If a user specified what the sum and the product of these three numbers were to be, how could we find each number using Python?


Example:


What is the sum of the three numbers?

User input= 30

What is the product of the three numbers?

User input= 990


Output would be (in varied possible orders):

1st number= 9  2nd number=10  3rd number = 11

1st number=9   2nd number=11  3rd number= 10

1st number=10 2nd number=9    3rd number=11

1st number=10 2nd number=11  3rd number=9

1st number=11 2nd number= 9   3rd number=10

1st number=11 2nd number=10  3rd number=9


I need so much help with this problem in particular and how to generate the three unknowns. I would really appreciate all of the help I could get! Thank you so much!

Explanation / Answer

s=int(input("What is sum of three numbers: "))

p=int(input("What is product of three numbers: "))



for a in range(1,s+1):

for b in range(1,s):

c=s-a-b

if a*b*c==p:

print("1st number= "+str(a)+" 2nd number="+str(b)+" 3rd number = "+str(c))