docs

a slatepencil documentail site

View on GitHub

Define a procedure perfectSquare(n), which returns True if n is a perfect square and False otherwise. Your function should have type (positiveInt) -> boolean

import math
def perfectSquare(n):
    x = math.sqrt(n)
    return x - math.floor(x) == 0