[Tutor] Outstanding Python Issue

eric grunfeld grunfelderic at gmail.com
Tue Aug 11 15:27:13 EDT 2020


Hello Everyone:

I have been having some issues with this function in Python:

Here it is:

def convert_distance(miles):
    km = miles * 1.6  # approximately 1.6 km in 1 mile
return km

my_trip_miles = 55

This has been the response:

Error on line 4: return km ^ SyntaxError: 'return' outside function
Because I am new to Python programming, I am sure that there is an easy
solution.

I look forward to your thoughts/comments about this.

All the best,
Eric


More information about the Tutor mailing list