0
To write a function to print all the Pythagorean tripletfor range.i have written the code but i want to convert into function.
import math a=int(input("start range")) b=int(input("end range")) for c in range(a,b+1): for d in range(c,b+1): for l in range(a,b+1): p=c**2+d**2 if l==math.sqrt(p): print (c,d,l)
1 Answer
0
import math
a=int(input("start range"))
b=int(input("end range"))
def trip(x,y):
for c in range(x,y+1):
for d in range(c,y+1):
for l in range(x,y+1):
p=c**2+d**2
if l==math.sqrt(p):
print (c,d,l)
trip(a,b)