Problem in PYTHAGOREAN'S CHALLENGE

this is my code:
N=int(input())
for n in range(N):
A=int(input())
for b in range(0,A+1):
for a in range(b):
if((a2)+(b2)==A):
print((a,b),end="")
print("\r")

and is running fine on anaconda but showing wrong answer here. where am i going wrong?

plzz help me with the above doubt??!!

Your code is not correct for any of the test cases. you need to take inputs at starting only, then perform iterations…

  • also , you haven’t check for the condition if a<=b therefore (0,5) (5,0) can occur.

I’m providing you with the modified code for your reference, Please understand the logic behind the code, try dry run of the code.
code here : https://ide.codingblocks.com/s/115853

Solution