I wanted to make a simple square root calculator.
num = input('Enter a number and hit enter: ')
if len(num) > 0 and num.isdigit():
new = (num**0.5)
print(new)
else:
print('You did not enter a valid number.')
It doesn't seem as if I have done anything wrong, however, when I attempt to run the program and after I have input a number, I am confronted with the following error message:
Traceback (most recent call last):
File "/Users/username/Documents/Coding/squareroot.py", line 4, in <module>
new = (num**0.5)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'float'
Process finished with exit code 1