1 of 1 ·Lists

Lesson 1 · Python Foundation
Storing multiple items.
Lists & Functions
A list holds several values. A function gives a small job a name so you can use it again. Practise one list and one short function separately before combining them.
Click to zoomStoring four marks meant four variables. Storing forty students' names would mean forty. That clearly doesn't scale.
A list holds many values under one name:
marks = [85, 92, 78, 88]
names = ["Ananya", "Bilal", "Chetan"]
Square brackets, values separated by commas. One name, as many items as you like — and you can add more while the program runs.
10 more parts in this lesson
Walkthroughs, code labs, mini-games and the checkpoint quiz unlock when you buy the course.