← Python Basics
Lesson 2 of 3
Lists and loops
Watch, read the card, then practise. Lists · For loops · List methods
The video for this lesson is being recorded.
Meanwhile, the notes below and the 60-second cards cover the same ideas.
Practise this topicLists
A list keeps several values in order, in one variable.
Remember: The first item is at position 0, not 1.
For loops
A for loop runs the same lines once for each item, so you don't repeat yourself.
Remember: Indent the lines that belong inside the loop.
List methods
Lists come with built-in methods to add, remove and sort items.
Remember: sort() changes the list itself and returns None.
Try the example in Code Lab
marks = [72, 85, 90] print(marks[0], marks[-1], len(marks))