Question
One lap around a standard high-school running track is exactly 0.25 miles. Write the function miles_to_laps() that takes a number of miles as an argument
One lap around a standard high-school running track is exactly 0.25 miles. Write the function miles_to_laps() that takes a number of miles as an argument and returns the number of laps. Complete the program to output the number of laps.
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:
1.5
the output is:
6.00
Ex: If the input is:
2.2
the output is:
8.80
Your program must define and call the following function:
def miles_to_laps(user_miles)
Here is what i have.
def miles_to_laps(user_miles):
laps = user_miles / 0.25
return '{:.2f}'.format(laps)
if __name__ == '__main__':
user_miles = float(input())
laps = miles_to_laps(user_miles)
print(laps)
I have 2/5 of the outputs correct but i cannot figure out the last three
1:
1/1
Input
1.5
Your output
6.00
2:
1/1
Input
2.2
Your output
8.80
3:
0/3
miles_to_laps(1.5)
4:
0/3
miles_to_laps(2.2)
5:
0/2
- miles_to_laps(26)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started