Question: How to combine this code? can you explain it step by step as well? what I'm hoping to do with this code is get a

How to combine this code?

can you explain it step by step as well?

what I'm hoping to do with this code is get a and b and inputting c using any number in order to print out "all" a and b values

def pythagoreanTriplets(limits) : c, m = 0, 2

# Limiting c would limit # all a, b and c while c < limits : # Now loop on n from 1 to m-1 for n in range(1, m) : a = m * m - n * n b = 2 * m * n c = m * m + n * n

# if c is greater than # limit then break it if c > limits : break

print(a, b)

m = m + 1 and

limit=int(input("Enter upper limit:")) c=0 m=2 while(climit): break if(a==0 or b==0 or c==0): break print(a,b) m=m+1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!