1def is_cube(n):
2 guess = n**(1.0/3.0)
3 iguess = int(guess)
4 if iguess * iguess * iguess == n:
5 print(True, "it's cubed root is", iguess)
6 return
7 iguess = iguess + 1
8 if iguess * iguess * iguess == n:
9 print(True, "it's cubed root is", iguess)
10 return
11 print(False, "it's cubed root is", guess)
12
13is_cube(9) # No
14is_cube(27) # Yes