In this lesson, you’ll see how to use a lambda for the key of the sort()
method of lists. sort()
has two parameters. key
is None
by default. reverse
is False
by default.
You won’t be altering reverse
, but you will be looking at key
because you can use a lambda expression to alter the behavior of sort()
. When you use lambda
, you can extend key
to be much more versatile.
Justin Richie on July 21, 2020
At 1:25 in this video, what is the [-1] doing here?