197k views
0 votes
One lap around a standard high-school running track is exactly 0.25 miles. Write a program that takes a number of miles as input, and outputs the number of laps. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('%0.2f' % 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)

2 Answers

3 votes

Answer:

def miles_to_laps(user_miles):

return user_miles/0.25

if __name__ == '__main__':

miles = float(input(""))

lap = miles_to_laps(miles)

print("%.2f"%lap)Explanation:

User Kelby
by
4.6k points
5 votes
Start like this

def miles_to_laps(user_miles):
return user_miles/0.25

if __name__ == '__main__':
miles = float(input("Enter miles : "))
lap = miles_to_laps(miles)
print("Total lap count is %.2f"%lap)

Output is
First write 1.5 miles one than second one enter 2.2. Total lap count is 8
One lap around a standard high-school running track is exactly 0.25 miles. Write a-example-1
User Maleev
by
4.6k points