Python Program To Check Perfect Square Number

Perfect square numbers are the square of the whole numbers.

Perfect square numbers are: 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, ...

This Python program checks whether a given number is perfect square or not.

Python Source Code: Perfect Square Check


# Check for perfect square
def is_perfect_sqaure(n):
    root = n ** 0.5
    int_root = int(root)
    return int_root ** 2 == n

# Function Call
print(is_perfect_sqaure(1))
print(is_perfect_sqaure(5))
print(is_perfect_sqaure(88))
print(is_perfect_sqaure(121))

Output

True
False
False
True