python perfect square code example Example 1: python square #use the ** operator 3 ** 2 Example 2: python num perfect squares print(int(int(n)**.5))