Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 5 - Loops - Programming Exercises - Page 159: 5.6

Answer

Miles Kilometers | Kilometers Miles 1 1.609 | 20 12.430 2 3.218 | 25 15.538 ... 9 15.481 | 60 37.290 10 16.090 | 65 40.398

Work Step by Step

print(format("Miles", "<15s"), format("Kilometers", "10s"), " | ", format("Kilometers", "<15s"), format("Miles", "10s")) print("-----------------------------------------------------------------") miles = 1 kilometers = 20 count = 1 while count <= 10: print(format(miles, "<15d"), format(miles * 1.609, "<10.3f"), " | ", format(kilometers, "<15d"), format(kilometers / 1.609, "<10.3f")) miles += 1 kilometers += 5 count += 1
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.