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