← Courses

Python for AI — Beginner Foundations

Data Science

Data Structures · Lesson 35 of 76

Lists

A list holds many values in order, inside square brackets:

Python

Loop over a list to work through every item:

Python

Your turn: make a list of three towns and print each on its own line.

Check your understanding

Exercise — check your understanding

Make a list towns with exactly three town names, then set count to how many it has using len.

You’re reading for free. Sign in to keep your progress and earn a certificate when you finish.Sign in to keep my progress →