program4_1.py Write a program that uses a for loop and the range function to generate a table of areas and circumferences of 10 circles with radii from 10 to 100 in increments of 10. See Required Output below. The radii should display centered in a column 10 characters wide with 1 decimal place. The areas should be centered in a column 14 characters wide with 4 decimals and the circumferences should be centered in a column 18 characters wide with 3 decimals. For full points, include centered column headings as shown. I have to write in Python. I have most of the code completed, but I cannot figure out how to make the heading appear once. Below is what I currently have. def main (): for r in range(10, 101, 10): print(f'{"Radius":^10}{"Area":^12}{"Circumference":^21}') area = (r ** 2) * 3.14 c = 2 * 3.14 * r print(f'{r:^10.1f}{area:^14.4f}{c:^18.3f}') main ()
program4_1.py
Write a program that uses a for loop and the range function to generate a table of areas and circumferences of 10 circles with radii from 10 to 100 in increments of 10. See Required Output below. The radii should display centered in a column 10 characters wide with 1 decimal place. The areas should be centered in a column 14 characters wide with 4 decimals and the circumferences should be centered in a column 18 characters wide with 3 decimals. For full points, include centered column headings as shown.
I have to write in Python. I have most of the code completed, but I cannot figure out how to make the heading appear once. Below is what I currently have.
def main ():
for r in range(10, 101, 10):
print(f'{"Radius":^10}{"Area":^12}{"Circumference":^21}')
area = (r ** 2) * 3.14
c = 2 * 3.14 * r
print(f'{r:^10.1f}{area:^14.4f}{c:^18.3f}')
main ()

Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images









