Skip to content
← Python for AI/ML · all 50 levels

List methods

Level 23 of 50 · Data structures

Level 23 of 50

List methods

explained with Eid shopping. Watch the reel, then work through it below: run the code, take the quiz, keep the cheat sheet.

📒 Open the cheat sheet
SanaChand raat! Ayesha keeps adding things to her Eid shopping!
TeacherLists have tools to grow and shrink. List methods!
eid.py
cart = ["kurta", "shoes"]
cart.append("bangles")
print(cart)
Teacher.append() adds a new item, right at the END!
SanaAnd if she changes her mind about the shoes?
eid.py
cart = ["kurta", "shoes"]
cart.remove("shoes")
print(cart)
Teacher.remove() takes it out by name! And .pop()? That removes the last item.

⏸ Pause & predict: what prints?

order = ["Ali", "Zara", "Hamza"]
order.pop()
print(order)

Where this leads

Python is step one. Building AI that ships is the rest.

The diploma takes you from zero to deployed computer vision, LLM and agent projects, with engineers who build them for a living. Already code? The bootcamp does it in three months.