Work with real shapes of data / CORE PATH
Lists, slices & comprehensions
Sequences preserve order, including repeated values.
A list can hold landing records, but it has no enforced table schema.
Understand the idea
Sequences preserve order, including repeated values. A list can hold landing records, but it has no enforced table schema.
Work through the practice with a tiny fixture, predict the result before running it, and record one boundary case. Use the exit check as evidence before moving on.
What to learn
- Use indexes, slices, append and list comprehensions.
- Understand aliasing, copying and in-place methods.
- Preserve input order when filtering and deduplicating.
A small original example
records = ["a", "b", "c"]
last_two = records[-2:]
print(last_two)
print(records) # still intactPractice on your own data
Task 09: return the last n records without changing the input list.
Practice this lesson in the Python lab →
latest([1, 2, 3], 2) is [2, 3]; n=0 returns []; negative n is invalid.
Common pitfalls
- sort() changes the list and returns None.
- items[-0:] returns the full list, not an empty list.
Prerequisites
Boot.dev chapter 9 · 03:44:14 ↗
Video and playlist companions
Choose one explanation for the concept, then attempt the practice. These are topic mappings, not a claim that every linked lesson covers every outcome.
Boot.dev · Python for Beginners
Loads YouTube on request. Open on YouTube ↗ if the owner restricts embedding.
كورس Python منحة ITI
Loads YouTube on request. Open on YouTube ↗ if the owner restricts embedding.
Python Full Course for Beginners (13 Hours) – From Zero to Hero
Loads YouTube on request. Open on YouTube ↗ if the owner restricts embedding.
Sources and further reading
- Boot.dev · Python for Beginners ↗User-selected YouTube course
- كورس Python منحة ITI ↗User-selected ITI playlist
- Harvard CS50P · lectures & problem sets ↗User-selected HarvardX CS50P course
- Python language tutorial ↗Official documentation
- Python Full Course for Beginners (13 Hours) – From Zero to Hero ↗User-selected YouTube resource
Track progress on this topic → · Markdown source ↗