I have written a simple function to find the area of a square:
side_length = float(raw_input("Length in cm: "))
area = side_length ** 2
print “this is not a number”
When I attempt to run this, after I input the “side_length” I get the error stating: ‘float’ object has no attribute ‘isalpha’.
If I get rid of the ‘float’ in front of the ‘raw_input’, it states: unsupported operand types for ** or pow(): ‘unicode’ and ‘int’
^ I am not sure what this even means.
Is there a way to solve this? I would like it to print “this is not a number” if the user inputs a letter and print out the area if it is.
Thanks in advance