I wonder if some could read this code and tell me why this is happening. I can't be the first one to come across this, but I have looked around and I can't find an answer in a book or elsewhere.
This has to be something minor, but I can't see it.
# This program will find and calculte the radius
# area and circumference of a circle.
def main():
print('Radius\tArea\tCircumference')
print('----------------------------')
print()
for radius in range(1, 11):
for area in range(1, 11):
for circumference in range(1, 11):
pi = 3.14
diameter = radius * 2
radius = diameter / 2
area = pi * radius**2
circumference = (2 * pi) * radius
print(radius, '\t', area, '\t',format(circumference, '.2f'))
main()
Output:
Radius Area Circumference
----------------------------
1.0 3.14 6.28
2.0 12.56 12.56
3.0 28.26 18.84
4.0 50.24 25.12
5.0 78.5 31.40
6.0 113.04 37.68
7.0 153.86 43.96
8.0 200.96 50.24
9.0 254.34 56.52
10.0 314.0 62.80
>>>
The out-put is aligned in the first two columns, but four out of the ten in the third column seem to be tabbed to the right. ??
\tworks.