[Type C] Python Revision Tour-1 – Chapter 1

|
Table of Contents

9. Write a program that prints a table on two columns – a table that helps converting miles into kilometers.

print("Miles    Kilometers")
print("-------------------")
for miles in range(1, 11):
    kilometers = miles * 1.60934
    print(f"{miles}        {kilometers}")
Output
Miles    Kilometers
-------------------
1        1.60934
2        3.21868
3        4.82802
4        6.43736
5        8.0467
6        9.65604
7        11.26538
8        12.87472
9        14.48406
10        16.0934
"Spread the light within, illuminate the hearts around you. Sharing is not just an action, but a sacred journey of connecting souls."~ Anonymous

Leave a Reply

Your email address will not be published. Required fields are marked *