Respuesta :
Answer:
The program in python is as follows:
def miles_to_laps(user_miles):
return (user_miles/0.25)
mile = float(input("Number of Miles: "))
print("Number of laps: ",end="")
print('{:.2f}'.format(miles_to_laps(mile)))
Explanation:
The first line defines the function miles_to_lap
def miles_to_laps(user_miles):
This line returns the equivalent number of laps
return (user_miles/0.25)
The main method starts here
This line prompts user for input
mile = float(input("Number of Miles: "))
This line prints the string "Number of laps", without the quotes
print("Number of laps: ",end="")
This prints the equivalent number of laps to two decimal places
print('{:.2f}'.format(miles_to_laps(mile)))
The program converts the number of miles enters by the user to an equivalent measure in laps is written in python 3 thus :
def miles_to_laps(miles):
#initialize the function which takes in a single parameter
return (miles/0.25)
mile_value= eval(input("Number of Miles: "))
#allows user to input a value representing distance in miles
print("Number of laps: ",end="")
#display Number o laps with cursor on th same line
print('{:.2f}'.format(miles_to_laps(mile_value)))
#pass user's vlaue to the function to Obtain the lap value.
A sample run of the program is attached.
