[Tutor] Outstanding Python Issue

Meher Kolli meherkp at gmail.com
Tue Aug 11 20:21:38 EDT 2020


The return statement should be inside the def

Meher


On Tue, Aug 11, 2020 at 4:27 PM eric grunfeld <grunfelderic at gmail.com>
wrote:

> 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
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


-- 
Meher Kolli


More information about the Tutor mailing list