Lists
Python List Interview Questions
List questions are the everyday work of Python: building a list, filtering it, combining two of them, usually in a single line.
What list questions ask you to do
Across the questions here, these are the shapes that come up:
- Filter and transform in one step
- Flatten a nested structure
- Combine two lists with a rule about duplicates
- Split a list into fixed-size batches
- Return a new list without changing the original
Common mistakes with lists
Assigning a list to a second name does not copy it. Both names point at the same list, so adding to one changes the other, and the problem usually shows up a long way from the line that caused it. Copying it explicitly is the fix.
Questions to practice
Roles this comes up in
Companies these come from
Other topics
- Filtering7
- Logical operators4
- Calculations11
- Conditional logic12
- NULL handling9
- Dates16
- Joins15
- Aggregations14
- Subqueries5
- Window functions32
- Reshaping15
- Arrays6
- Strings11
- Hashing8
- Two pointers4
- Sliding window1
- Binary search4
- Sorting1
- Math3
- Tuples3
- Dictionaries3
- Ranking16
- Running totals10
- Deduplication2
- Chunking1
- Similarity1
- Token budget2
- Parsing4
- Backoff3
- Agent loop1
- Cost1