List Operations
Predict Output Beginner
Question
What does this code print?
Code
a = [1, 2, 3]
a.append(4)
print(len(a))
Hint
append adds one element.
Explanation
a starts as [1, 2, 3] with length 3. append(4) adds 4, making [1, 2, 3, 4] with length 4.
Related Resources
Related Lessons
- Lists
Learn Python lists.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.