Sort students
Created on Dec. 25, 2016 by Antoine Mazières
As an introduction to sorting lists in Python you'll have to implement two functions.
In this exercise we represent students as a pair of (mark,
full_name)
, so a tuple of two elements.
And in this exercises we represent students as lists of pairs, like:
1 |
|
Part 1
Write a function named sort_by_mark
that take as argument a list of
students and returns a copy of it sorted by mark in descending
order. Such as:
1 2 |
|
Part 2
Write a function named sort_by_name
that take as argument a list of
students and returns a copy of it sorted by name in ascending
order, such as:
1 2 |
|
Advices
Take a look at the Sorting howto.
There's no corrections yet, hit the `Submit` button to send your code to the correction bot.
Keyboard shortcuts:
- Ctrl-Enter: Send your code to the correction bot.
- Escape: Get back to the instructions tab.