Python, square and cubic

ProgJo Posted messages 3 Status Member -  
fiddy Posted messages 441 Registration date   Status Contributor Last intervention   -
Hello,

I need to build a program that prompts the user to enter a number, and from that number, I need to validate whether it is cubic and square. I'm having some difficulties writing it because, despite the SQRT() command as well as MATH.POW(x, 1.0/3) helping me find the square or cube of the number, I don't know how to validate to say whether the number is square and cubic... I'm missing the validation part and I'm unable to do it; I can't find enough documentation.
Thank you

Configuration: Mac OS X (10.10.2) / Chrome 42.0.2311.90

5 answers

  1. Anonymous user
     
    Hi,

    A number is a square if its square root is an integer? The same for cubic?
    6
    1. ProgJo Posted messages 3 Status Member
       
      Yes, of course... But the only problem is that the return value is a float (so for example, 36=6.0.... Is there a way to ensure that if the number is an integer (even if it is represented as a float), it executes a specific line of code; otherwise, tell the user that the number is not square/cubic?
      0