[Tutor] Outstanding Python Issue

abishek mugunthan abishekmugunthan29 at gmail.com
Tue Aug 11 19:46:13 EDT 2020


Hi Eric

The return should be indented to be within the function block

Thanks and Regards
Abishek


On Tue, Aug 11, 2020, 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
>


More information about the Tutor mailing list