0
What's wrong?
from math import pi def roundarea(radius): if radius>0: return sqr(radius) * pi else: return "Wrong!" rndr = roundarea x = input ("Radius is: ") print(rndr(x))
7 Antworten
+ 1
Try this:
import math
def roundarea(radius):
if radius>0:
return math.sqrt(radius) * math.pi
else:
return "Wrong!"
x = int(input ("Radius is: "))
print(roundarea(x))
You have used a function named sqr() which was not defined. So I used the math module in Python to calculate the square-root and to get the Pi values. And I also converted the input to an integer using the int() function.
0
The same
0
what's the error?
0
Radius is: print(roundarea(x)) in the end
0
from math import pi
def roundarea(radius):
if radius>0:
return sqr(radius) * pi
else:
return "Wrong!"
x = input ("Radius is: " )
print(roundarea(x))
Result:
Radius is: print(roundarea(x))
0
Not sqrt, sqr
And it's wrong too