Suppose we have two numbers x and y. We have to concatenate them and check whether the resultant number is perfect square or not.
So, if the input is like x = 2 y = 89, then the output will be True as after concatenating the number will be 289 which is 17^2.
To solve this, we will follow these steps −
Let us see the following implementation to get better understanding −
from math import sqrt def solve(x, y): first_num = str(x) second_num = str(y) res_num = int(first_num + second_num) sqrt_val = int(sqrt(res_num)) if sqrt_val * sqrt_val == res_num: return True return False x = 2 y = 89 print(solve(x, y))