Conditions & nested lists

Report a typo

Imagine you have a list of students and their grades for an exam:

students = [["Jane", "B"], ["Kate", "B"], ["Alex", "C"], ["Elsa", "A"], ["Max", "B"], ["Chris", "A"]]

Select only students with the best grade ("A") and print their names in a list. Do all this in one line. We have already created the students variable with other names and grades.

You can create and print a list in one line if you start directly with print([#your condition here]).
Write a program in Python 3
# the list "students" is already defined
___

Create a free account to access the full topic