Pythagorean's Challenge

Test Cases failed
import math

num=int(input())
while(num!=0):
A=int(input())
x=math.sqrt(A)
y=x*x
z=A-y

if z==0:
    # print("z == 0 for A = ", A)
    x=int(x)
    # print("x == ", x)
    for i in range (0,x):
        # print("i == ", i)
        for j in range (i+1,x+1):
            # print("j == ", j)
            if i*i + j*j==A:
                flag=True
                print("({},{})".format(i,j),end=" ") 
        continue
    
    if flag:
        print()                    
else:
     break  

num-=1

Hey!
You are handling just perfect squares, what about a number like 13 (2*2 + 3*3)
Using two for loop will do the job -

> for i in range(o,n):
>     for j in range(i,n):
>         if i*i + j*j = A: print(...)

where n can be sqrt of A

what does this mean -" invalid literal for int() with base 10: ‘’?
how to resolve this error??
my current code is:

testcase=int(input())
while(testcase>0):
n=int(input())
for i in range(0,n):
for j in range(i,n+1):
if (ii+jj==n):
print("({},{})".format(i,j),end=" ")
else:
continue
testcase=-1

Python generates that error message whenever you call the int() builtin function with a string argument that cannot be parsed as an integer. So you might me passing an invalid input format.
Although the code is fine, however you can optimize it by changing the i,j maximum values in the for loops with root of n.

So what should I change in the code to avoid this error??

There is nothing wrong in the code, just while taking input make sure you are providing a string that can be converted to an integer to avoid that error

While submitting the code on the platform you can optimize it by changing the i,j maximum values in the for loops with root of n.
And change testcase=-1 with testcase-=1

Hope this helps :slightly_smiling_face:

Still getting wrong answer for the first test case

Failing for input 0.
This for loop will not execute - for i in range(0,p), so code will not print anything
Instead change the range(0,p+1)
It will work