16 lines
310 B
Python
16 lines
310 B
Python
def cube_root(n: int) -> int:
|
|
'''
|
|
Returns the cube root of the input number
|
|
|
|
Args:
|
|
n (int): The number to cube root
|
|
|
|
Returns:
|
|
int: The cube root result
|
|
'''
|
|
if n >= 0:
|
|
return n ** (1 / 3)
|
|
else:
|
|
raise ValueError('A number larger than 0 was expected')
|
|
|