Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Unexpected token on python sort method


HI all,

When i use the following example code in Array.sort() method in python i get an unexpected error message:

numbers = [45,83,67,15]
numbers.sort()              # numbers is now [15,45,67,83]
numbers.sort(reverse=True)  # numbers is now [83,67,45,15]
numbers.sort(key=lambda n:n%9)  # numbers is now [45,83,67,15] (sorted base on value mod 9)

Am i doing something wrong or is it a bug?

Thanks in advance

[Python] Function definition not working - Gold Rush

Looks like we don’t have support for lambda in our Python parser yet: