+ 1
Error: must be real number, not str
Hi, why in the following block I get this error: "must be real number, not str" import math def sqrt_root(x): return math.sqrt(x) x = input("Enter your number:") print("The SQR ROOT of ", x, " is:", sqrt_root(x))
2 Antworten
+ 4
When you call the function, call it like this:
sqrt_root(int(x))
You are passing in a string, gotten from input, into a function that requires a integer. You need to convert it using the int() function.
- 1
Ariela your suggestion worked. Thanks for your clear answer