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

List slicing & in

Level 24 of 50 · Data structures

Level 24 of 50

List slicing & in

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

📒 Open the cheat sheet
SanaSelection day! Coach wants Hamza's last 3 scores. Fast!
TeacherSlice the list, just like a string! And ask questions with in!
hamza.py
runs = [12, 0, 45, 30, 8]

print(runs[-3:])
Teacher-3 : means from the 3rd last, all the way to the end!
SanaWait, did he get a duck? How do I check for 0?
hamza.py
runs = [12, 0, 45, 30, 8]

print(0 in runs)
TeacherUse in! It answers with True or False.

⏸ Pause & predict: what prints?

runs = [4, 6, 1, 0, 6]
print(runs[1:3])

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.