Space Python Loading Python…

Sorting and Reversing Lists

 
0:00 / 0:00

Challenge

Practise what this example shows with these challenges.

sort() returns None

Fix the codeEasy 3 stages

crew = crew.sort() leaves the roster as None. Predict it, find out what sort() really gives back, fix it by sorting in place, then sort readings from highest to lowest and keep the top three.

Start the challenge

Sorted copy

Write the codeEasy 2 stages

Print the roster A–Z for a report with sorted() while the sign-up order stays exactly as it was, then sort names like de Vries and van Dijk correctly with key=str.lower.

Start the challenge

Discussion

Stuck on this example or want to go further? Ask here, or see what others asked.

Log in to ask and reply.

script.py
PythonLn 1, Col 1Spaces: 4
Loading the Python environment…

Separate arguments with commas. They're passed on every Run as sys.argv[1:].