Lists and List Methods
Like this video? Get new free AI lessons on YouTube.
SubscribeA list holds many values in order, in a single variable. Lists are the most used data structure in Python: to-do items, scores, names, rows of data. In this lesson you will create lists, read from them, and change them with built-in methods.
What You'll Learn
- Creating lists and accessing items by index
- Slicing to grab parts of a list
- Adding and removing items
- Sorting and useful built-in functions
Creating and Accessing
Like strings, lists index from 0, and -1 is the last item.
Slicing
Changing a List
Unlike strings, lists are mutable: you can change them in place.
Sorting
sort() reorders the list in place; add reverse=True for descending:
Built-in Helpers
Key Takeaways
- Lists use square brackets:
[1, 2, 3] - Index from
0,-1from the end; slice with[start:end] - Lists are mutable:
append(),insert(),remove(),pop() sort()reorders in place,reverse=Truefor descendinglen(),max(),min(),sum()summarize a list
Quiz
Up next · Lesson 17 of 24
Tuples
1 min read
16 of 24 lessons done

Ask Byte about this lesson
A private chat about this lesson. Byte has read the whole lesson, answers in seconds, and shows the section each answer comes from. Ask follow-ups in any language.
Questions & Answers
Public questions about this lesson. The AI Tutor answers right away in your language, the FreeAcademy team checks answers, and every learner can read them.

