+ 1
Can you help me fix my code
3 Respostas
+ 1
while radius <= endRadius:
#Test and loop
diameter = (radius * 2)
circumference = (2 * pi * radius)
area = (pi * (radius * radius ))
#This block of codes is the problem, because from the start, the value of radius is 0 and if you multiply 0 by another number it is still zero.
#Observe from this block of codes inside this while loop, every equation has the variable "radius" which is equal to 0, therefore the value of Circumference, Area, and Diameter will become all 0 and moreover the value of radius every loop is always 0 and not changing.
#That is also the reason why the final output is all 0.
To solve this, you need to change the value of variable "radius" every loop.
+ 1
you are right the area is always zero. I pay more attention to the code than the formula. Thanks for teaching me something
0
soloLearn only read once all the inputs your code is good. Try to enter all the data at once separated with a line break for example:
9.0
8.9