1 2 3 4 5 6
isCube = False s = int(x ** (1.0/3)) for i in range(1, s + 2): if i**3 == x: isCube = True