check if number is perfect cube python

Solutions on MaxInterview for check if number is perfect cube python by the best coders in the world

showing results for - "check if number is perfect cube python"
Alina
26 Sep 2020
1x = int(input())
2print(int(round(x ** (1. / 3))) ** 3 == x)
Alexis
01 Mar 2016
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
queries leading to this page
python program to find perfect cube roothow to check a number is perfect cube or not in pythonperfect cubes code in pythonhow to check for a perfect cube in pythonwap to find a number is perfect cube in pythoncheck if a number is perfect cube or not in python 2how to check if a number is a perfect square pythonperfect cube in pythoncheck perfect cube in pythonprint out whether the number is a perfect cubepython number is a perfect cubeperfect cube or not in pythonperfect cube numbers pythonpython program to check perfect cube and return valuec program to print perfectb cubespython program to check number is perfect cubeif the number is cube pythonperfect cube python programputhon perfect number cubepyhton test if number is a cubeis perfect cube pythonfind perfect cubes in a list pythonhow to check a given number is perfect cube in pythoncheck whether square root equals to cube root in pythonhow to check if a number is square in pythonperfect cubein pythonhow to check if a number is a perfect cube in pythonpython check if a number is a perfect squareis cube or not pythonpython check if number is perfect squarepython check a number is perfectcheck if element is cube root in pythoncheck if number is perfect cube pythonfind is cube or not in pythoncheck if a number is perfect cube in pythonhow to know a given number is a perfect cube pythonfind perfect cube pythonis a number a perfect cube in pythonpython program to check if the number is perfect cube or notcheck if number is perfect cube python