Question: A pedometer treats walking 2 , 0 0 0 steps as walking 1 mile. Write a steps _ ( t ) o _ ( m
A pedometer treats walking steps as walking mile. Write a stepstomiles function that takes the number of steps as a parameter and returns the miles walked. The stepstomiles function raises a ValueError object with the message "Exception: Negative step count entered." when the number of steps is negative. Complete the main program that reads the number of steps from a user, calls the stepstomiles function, and outputs the returned value from the stepstomiles function. Use a tryexcept block to catch any ValueError object raised by the stepstomiles function and output the exception message.
Output each floatingpoint value with two digits after the decimal point, which can be achieved as follows:
printfyourvalue:f
Ex: If the input of the program is:
the output of the program is:
Ex: If the input of the program is:
the output of the program is:
Exception: Negative step count entered.
A pedometer treats walking steps as walking mile. Write a stepstomiles function that takes the number of steps as a
parameter and returns the miles walked. The stepstomiles function raises a ValueError object with the message "Exception:
Negative step count entered." when the number of steps is negative. Complete the main# Define your method here
if nnamemain:
# Type your code here.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
