Tried solving the problem using for loops. it runs fine on pycharm ide. but fails all test cases upon submission

is it a problem with the runtime? The code works just fine. Any input, suggestions or hints will be helpful1 Here is the code:

import math
def pyth(c,d):
return ((c2)+ (d2))

a = []
t=int(input())
for m in range(t):
l=int(input())
a.append(l)

for n in range(t):
e = 0
j=a[n]
z= int(math.sqrt(j))
for i in range(0,z+1):
for k in range(i,z+1):
e=pyth(i,k)
if e == j:
print((i,k), end=’’)
else: continue
print(’’)

Hey @haxxpigmeow, changed your print statement a little bit and pls run this on python version 3.

import math
def pyth(c,d):
    return ((c**2)+ (d**2))

a = []
t=int(input())
for m in range(t):
    l=int(input())
    a.append(l)

for n in range(t):
    e = 0
    j=a[n]
    z= int(math.sqrt(j))
    for i in range(0,z+1):
        for k in range(i,z+1):
            e=pyth(i,k)
            if e == j:
                print("("+str(i)+","+str(k)+")", end=" ")
            else: continue
    print("")

It is working fine, pls have a look at it and ask if there is any confusion.
Thanks :slight_smile: