The timetable has one lesson per line: day hour subject, like "Mon 10 Art". Write day_plan(text, day): pick that day's lessons, sort them from earliest to latest, and return the subjects. If there are no lessons that day, return an empty list.
day_plan("Mon 10 Art\nTue 9 PE\nMon 8 Maths", "Mon")→['Maths', 'Art']day_plan("Tue 9 PE", "Fri")→[]def day_plan(text, day):
lessons = []
for line in text.splitlines():
# your code here: split the line; if it's this day, put (hour, subject) into lessons
pass
# your code here: sort lessons
return [subject for hour, subject in lessons]
Run tries the examples. When they look right, Submit.