14th Dec 2020, 10:13 PM
Akon C
Akon C - avatar
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.
15th Dec 2020, 1:33 AM
noteve
noteve - avatar
+ 1
you are right the area is always zero. I pay more attention to the code than the formula. Thanks for teaching me something
15th Dec 2020, 2:25 AM
Daniel Briceño
Daniel Briceño - avatar
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
14th Dec 2020, 10:55 PM
Daniel Briceño
Daniel Briceño - avatar