Chapter 13: Lists
Complete Python lesson for very beginners. Technical words are explained in simple language, and every outline topic includes a practical example, expected output, steps, and practice.
Chapter Overview
This Python tutorial chapter covers Lists through 15 connected topics. Work through the examples in order, check the expected output, and complete the practice after each topic.
- 13.1 Creating Lists
- 13.2 Accessing Elements
- 13.3 Negative Indexing
- 13.4 Slicing
- 13.5 Updating Elements
- Plus 10 additional Python topics in this chapter.
13.1 Creating Lists
Creating Lists is part of Lists. In simple language, it means an ordered, changeable collection.
It is one building block of lists and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.
Python / Practical Example
items = [10, 20, 30]
print(items)Expected Output
[10, 20, 30]Step-by-Step Explanation
- Use square brackets.
- Separate items with commas.
- A list keeps item order and can be changed.
13.2 Accessing Elements
Accessing Elements is part of Lists. In simple language, it means a Python idea used while learning lists.
It is one building block of lists and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.
Python / Practical Example
items = [1,2,3]
print(items[-1])Expected Output
3Step-by-Step Explanation
- Read the example from top to bottom.
- Identify the value, object, or operation related to this topic.
- Change one small input and predict the result before running it.
13.3 Negative Indexing
Negative Indexing is part of Lists. In simple language, it means a Python idea used while learning lists.
It is one building block of lists and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.
Python / Practical Example
items = [10, 20, 30]
print(items[-1])Expected Output
30Step-by-Step Explanation
- Negative indexes count from the end.
- -1 means the last item.
- The original collection is unchanged.
13.4 Slicing
Slicing is part of Lists. In simple language, it means a Python idea used while learning lists.
It is one building block of lists and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.
Python / Practical Example
value = "Python"
print(value[1:4])Expected Output
ythStep-by-Step Explanation
- Slice syntax uses start:stop.
- The start index is included.
- The stop index is excluded.
13.5 Updating Elements
Updating Elements is part of Lists. In simple language, it means a Python idea used while learning lists.
It is one building block of lists and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.
Python / Practical Example
items = [1,2,3]
print(items[-1])Expected Output
3Step-by-Step Explanation
- Read the example from top to bottom.
- Identify the value, object, or operation related to this topic.
- Change one small input and predict the result before running it.
13.6 append()
append() is part of Lists. In simple language, it means a Python idea used while learning lists.
It is one building block of lists and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.
Python / Practical Example
items = ["a", "b"]
items.append("c")
print(items)Expected Output
['a', 'b', 'c']Step-by-Step Explanation
- Create a list.
- append() adds one item to the end.
- Print the changed list.
13.7 extend()
extend() is part of Lists. In simple language, it means a Python idea used while learning lists.
It is one building block of lists and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.
Python / Practical Example
items = [1, 2]
items.extend([3, 4])
print(items)Expected Output
[1, 2, 3, 4]Step-by-Step Explanation
- Create a list.
- extend() adds each item from another iterable.
- Print the resulting list.
13.8 insert()
insert() is part of Lists. In simple language, it means a Python idea used while learning lists.
It is one building block of lists and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.
Python / Practical Example
items = ["a", "c"]
items.insert(1, "b")
print(items)Expected Output
['a', 'b', 'c']Step-by-Step Explanation
- Choose the insertion index.
- insert() places the item there.
- Existing items move to the right.
13.9 Removing Elements
Removing Elements is part of Lists. In simple language, it means a Python idea used while learning lists.
It is one building block of lists and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.
Python / Practical Example
items = ["a", "b", "c"]
items.remove("b")
print(items)Expected Output
['a', 'c']Step-by-Step Explanation
- remove() deletes the first equal value.
- The list changes in place.
- Use pop() when you need removal by index.
13.10 Sorting
Sorting is part of Lists. In simple language, it means a Python idea used while learning lists.
It is one building block of lists and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.
Python / Practical Example
values = [3, 1, 2]
print(sorted(values))
print(values)Expected Output
[1, 2, 3]
[3, 1, 2]Step-by-Step Explanation
- sorted() returns a new sorted list.
- The original list remains unchanged.
- list.sort() would sort the list in place.
13.11 Reversing
Reversing is part of Lists. In simple language, it means a Python idea used while learning lists.
It is one building block of lists and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.
Python / Practical Example
values = [1, 2, 3]
values.reverse()
print(values)Expected Output
[3, 2, 1]Step-by-Step Explanation
- reverse() changes a list in place.
- The order is reversed.
- No new list is required for this operation.
13.12 Searching
Searching is part of Lists. In simple language, it means a Python idea used while learning lists.
It is one building block of lists and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.
Python / Practical Example
items = [1,2,3]
print(items[-1])Expected Output
3Step-by-Step Explanation
- Read the example from top to bottom.
- Identify the value, object, or operation related to this topic.
- Change one small input and predict the result before running it.
13.13 Copying Lists
Copying Lists is part of Lists. In simple language, it means an ordered, changeable collection.
It is one building block of lists and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.
Python / Practical Example
original = [[1], [2]]
shallow = original.copy()
shallow[0].append(9)
print(original)Expected Output
[[1, 9], [2]]Step-by-Step Explanation
- copy() makes a shallow copy of the outer container.
- Nested mutable objects can still be shared.
- Use deepcopy() only when a fully independent nested copy is actually needed.
13.14 Nested Lists
Nested Lists is part of Lists. In simple language, it means an ordered, changeable collection.
It is one building block of lists and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.
Python / Practical Example
items = [1,2,3]
print(items[-1])Expected Output
3Step-by-Step Explanation
- Read the example from top to bottom.
- Identify the value, object, or operation related to this topic.
- Change one small input and predict the result before running it.
13.15 List Best Practices
List Best Practices is part of Lists. In simple language, it means an ordered, changeable collection.
It is one building block of lists and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.
Python / Practical Example
items = [1,2,3]
print(items[-1])Expected Output
3Step-by-Step Explanation
- Read the example from top to bottom.
- Identify the value, object, or operation related to this topic.
- Change one small input and predict the result before running it.
Common Beginner Mistakes
- Copying code without predicting what each line does.
- Ignoring the first useful error message or traceback location.
- Mixing tabs/spaces or changing indentation accidentally.
- Using data of the wrong type for an operation.
- Trying to learn many advanced variations before mastering one small working example.
Chapter Practice
- Choose three topics from this chapter and re-type their examples without copying and pasting.
- For each example, change one input and predict the output first.
- Explain five technical terms from this chapter in your own beginner-friendly words.
- Create one small program that combines at least two chapter topics.
- Keep notes about errors you made and what fixed them.
Mini Project / Challenge
Create a small Python exercise that combines at least three ideas from Lists. Start with a tiny working version, test it, then improve it one step at a time.
- Choose three topics from this chapter.
- Write or adapt a small Python example using those topics.
- Predict the output before running the code.
- Test at least one different input.
- Write two sentences explaining what the program does and what you learned.
20 Questions & Answers
1. What is the main goal of Chapter 13?
The goal is to understand lists through small explanations, examples, and practice.
2. Should I memorize every command or method?
No. Understand the pattern, practice the common form, and learn how to read documentation when you need exact details.
3. Why are the examples small?
Small examples isolate one idea at a time, which makes errors easier to understand and fix.
4. What should I do when an example gives an error?
Read the last part of the traceback, check spelling and indentation, confirm the required package or file exists, and compare the input types with what the operation expects.
5. Why should I predict output before running code?
Prediction forces you to reason about the program instead of only copying it.
6. What should I remember about Creating Lists?
Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.
7. What should I remember about Accessing Elements?
Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.
8. What should I remember about Negative Indexing?
Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.
9. What should I remember about Slicing?
Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.
10. What should I remember about Updating Elements?
Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.
11. What should I remember about append()?
Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.
12. What should I remember about extend()?
Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.
13. What should I remember about insert()?
Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.
14. What should I remember about Removing Elements?
Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.
15. What should I remember about Sorting?
Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.
16. What should I remember about Reversing?
Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.
17. What should I remember about Searching?
Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.
18. What should I remember about Copying Lists?
Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.
19. What should I remember about Nested Lists?
Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.
20. What should I remember about List Best Practices?
Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.