Home › Python with Chai › Lesson 4

Lists: all the flavours in one place

Python with Chai, lesson 4 of 20. A short Hinglish video, simple English notes and code you can run, free.

Open the interactive lesson with Run button

The idea

A list is a box that holds many items together, written inside [ ].

Counting starts at 0, so the first item is flavours[0].

append() adds a new item, and len() tells you how many items there are.

The code

flavours = ["Masala", "Adrak", "Elaichi"]

print(flavours[0])
print(flavours[2])
flavours.append("Tulsi")
print(len(flavours))

Output:

Masala
Elaichi
4

Try it yourself

Remember

A list keeps all the flavours in one place.

← if-else: how much sugar? · for loops: try every flavour →

All lessons: Python with Chai