My code shows 3 decimal places but in the 3rd decimal place its always a 0. What can I do to fix this to where it gives me the third number.
print ('Radius Area Circumference')
for Radius in range(1 , 11):
Area = (Radius)**2*3.14
Circumference = (Radius)*2*(3.14)
a = Radius
b = Area
c = Circumference
print ('{:2d} {:10.3f} {:10.3f}'.format(a, (b), (c)))
here is an example of how its reading out.
Radius Area Circumference
1 3.140 6.280
2 12.560 12.560
3 28.260 18.840
4 50.240 25.120
import math
print ('Radius Area Circumference')
for radius in range(1 , 11):
area = radius**2*math.pi
circumference = radius*2*math.pi
print('{:2d} {:10.3f} {:10.3f}'.format(radius, area, circumference))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.