is_perfect_square(n) that returns True if the non-negative integer n is a perfect square, using the ** (power) operator to test candidates rather than importing math.sqrt.is_perfect_square(16)
True
4 ** 2 == 16.
is_perfect_square(15)
False
No integer squared equals 15.
Compute an approximate root with `n ** 0.5`, round it, then verify with **.
Check both the rounded-down and rounded-up integer candidates to avoid float rounding errors.