Created
December 2, 2020 06:20
-
-
Save angeloped/d7a7ed81b36828fcb8730a8256f4911d to your computer and use it in GitHub Desktop.
Determine if the number is perfect cube.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_cube(n): | |
return (n**(1.0/3))%1==0 | |
print(is_cube(28)) | |
print(is_cube(27)) | |
print(is_cube(10)) | |
print(is_cube(8)) | |
print(is_cube(3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment