Question: 5.17 LAB: Customized step counter Learning Objectives Create a function to match the specifications Use floating-point value division Write a program to get the user
5.17 LAB: Customized step counter
Learning Objectives
- Create a function to match the specifications
- Use floating-point value division
- Write a program to get the user input and call the custom function and produce the desired output using a format function to output the specified precision
Instructions
A pedometer treats walking 2,000 steps as walking 1 mile. It assumes that one step is a bit over 18 inches (1 mile = 36630 inches, so the pedometers assume that one step should be 18.315 inches).
Let's customize this calculation to account for the size of our stride. Write a program whose input is the number of steps and the length of the step in inches, and whose output is the miles walked.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('{:.2f}'.format(your_value))
Ex: If the input is:
5345 18.315 the output is:
You walked 5345 steps which is about 2.67 miles. Your program must define and call the following function. The function should return the amount of miles walked. def steps_to_miles(user_steps, step_length)
# Define your function here if __name__ == '__main__':
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
