Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13951

Is cube root integer?

$
0
0

This seems to be simple but I cannot find a way to do it. I need to show whether the cube root of an integer is integer or not. I used is_integer() float method in Python 3.4 but that wasn't successful. As

x = (3**3)**(1/3.0) is_integer(x)    True

but

x = (4**3)**(1/3.0) is_integer(x)    False

I tried x%1 == 0,x == int(x) and isinstance(x,int) with no success.

I'd appreciate any comment.


Viewing all articles
Browse latest Browse all 13951

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>