Presentation is loading. Please wait.

Presentation is loading. Please wait.

Miles to Kilometers problem

Similar presentations


Presentation on theme: "Miles to Kilometers problem"— Presentation transcript:

1 Miles to Kilometers problem
developing a solution

2 Your summer surveying job requires you to study some maps that give distances in kilometers and some that use miles. You and your coworkers prefer to deal in metric measurements. Write a program that performs the necessary conversion.

3 Your summer surveying job requires you to study some maps that give distances in kilometers and some that use miles. You and your coworkers prefer to deal in metric measurements. Write a program that performs the necessary conversion. Inputs: distance in miles

4 Your summer surveying job requires you to study some maps that give distances in kilometers and some that use miles. You and your coworkers prefer to deal in metric measurements. Write a program that performs the necessary conversion. Inputs: distance in miles Outputs: distance in kilometers

5 Your summer surveying job requires you to study some maps that give distances in kilometers and some that use miles. You and your coworkers prefer to deal in metric measurements. Write a program that performs the necessary conversion. Inputs: distance in miles Outputs: distance in kilometers Constants: 1 mile = kilometers 1.609 kilometers per mile Formulas: kilometers = kilometers per mile * miles

6 Your summer surveying job requires you to study some maps that give distances in kilometers and some that use miles. You and your coworkers prefer to deal in metric measurements. Write a program that performs the necessary conversion. Algorithm: Get the distance in miles. Convert the distance to kilometers. Display the distance in kilometers.

7 Your summer surveying job requires you to study some maps that give distances in kilometers and some that use miles. You and your coworkers prefer to deal in metric measurements. Write a program that performs the necessary conversion. Algorithm: Deskcheck: Get the distance in miles. 10 miles Convert the distance to kilometers. 1.609 * 10 = 16.09 Display the distance in kilometers. 16.09 kilometers

8 Coding: Put the Algorithm in a module as comments
Your summer surveying job requires you to study some maps that give distances in kilometers and some that use miles. You and your coworkers prefer to deal in metric measurements. Write a program that performs the necessary conversion. Coding: Put the Algorithm in a module as comments # milesToKilometers.py # by Ima Converter, Section M4 # Convert miles to Kilometers #Get the distance in miles. #Convert the distance to kilometers. #Display the distance in kilometers.

9 Coding: Implement the code for each comment
Your summer surveying job requires you to study some maps that give distances in kilometers and some that use miles. You and your coworkers prefer to deal in metric measurements. Write a program that performs the necessary conversion. Coding: Implement the code for each comment ... #Get the distance in miles. miles = eval(input("Enter miles"))

10 Your summer surveying job requires you to study some maps that give distances in kilometers and some that use miles. You and your coworkers prefer to deal in metric measurements. Write a program that performs the necessary conversion. Testing


Download ppt "Miles to Kilometers problem"

Similar presentations


Ads by Google