0
What am I doing wrong? Trying to compute the area of a circle. (Python)
I am attempting to write a program where you input the radius of a circle and get the area of the circle as the output. I made the following code: https://code.sololearn.com/c70Co2670bYt/?ref=app No matter what my input is, I get an output of 3.14.... Please help me fix this. Thanks!
3 ответов
+ 1
The problem is that you are using bool() instead of int() or float()
EDITED:
bool converts the value to 1 in this case.
+ 1
thanks, Cruz. Somehow I got bool and float mixed up.
0
import math
print(math.pi*float(input())**2)
Use a number type like float instead of bool. Bool will return True or False only.