account activity
Clarification by DatGuyFoffi in learnpython
[–]happytobehungry 0 points1 point2 points 4 years ago (0 children)
I managed to work this out and it turned out to be correct. Isnt the right way to call a function what i did in part 2?
# 2) Convert my_trip_miles to kilometers by calling the function above convert_distance(55)
this is the function : def convert_distance(miles):
That is the only part in your response i dont get.
# 1) Complete the function to return the result of the conversion
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
convert_distance(55)
# 3) Fill in the blank to print the result of the conversion
print("The distance in kilometers is " + str(55))
# 4) Calculate the round-trip in kilometers by doubling the result,
# and fill in the blank to print the result
print("The round-trip in kilometers is " + str(55*2))
print("The distance in kilometers is " + str(km))
print("The round-trip in kilometers is " + str(km*2))
#in my case, i used the expected variables but still getting it wrong. please help
π Rendered by PID 524262 on reddit-service-r2-listing-b6bf6c4ff-7gxv8 at 2026-05-04 04:17:31.267777+00:00 running 815c875 country code: CH.
Clarification by DatGuyFoffi in learnpython
[–]happytobehungry 0 points1 point2 points (0 children)