20.7k views
0 votes
Complete the function to return the result of the conversiondef convert_distance(miles):km = miles * 1.6 # approximately 1.6 km in 1 milemy_trip_miles = 55# 2) Convert my_trip_miles to kilometers by calling the function abovemy_trip_km =____# 3) Fill in the blank to print the result of the conversionprint("The distance in kilometers is " +____)# 4) Calculate the round-trip in kilometers by doubling the result,# and fill in the blank to print the resultprint("The round-trip in kilometers is " + ___)

User Fluidity
by
5.1k points

1 Answer

3 votes

Answer:

The complete program is as follows:

def convert_distance(miles):

km = miles * 1.6 # approximately 1.6 km in 1 mile

return km

my_trip_miles = 55

# 2) Convert my_trip_miles to kilometers by calling the function above

my_trip_km =convert_distance(my_trip_miles) #3) Fill in the blank to print the result of the conversion

# 4) Calculate the round-trip in kilometers by doubling the result,

print("The distance in kilometers is " +str(my_trip_km))

# and fill in the blank to print the result

print("The round-trip in kilometers is " + str(my_trip_km * 2))

Step-by-step explanation:

The program is self-explanatory because I used the same comments in the original question.

User Eek
by
5.2k points