MCPcopy Index your code
hub / github.com/geekcomputers/Python / cubeRoot

Function cubeRoot

find_cube_root.py:7–17  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5
6
7def cubeRoot():
8 x = int(input("Enter an integer: "))
9 for ans in range(0, abs(x) + 1):
10 if ans**3 == abs(x):
11 break
12 if ans**3 != abs(x):
13 print(x, "is not a perfect cube!")
14 else:
15 if x < 0:
16 ans = -ans
17 print("Cube root of " + str(x) + " is " + str(ans))
18
19
20cubeRoot()

Callers 1

find_cube_root.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected