Lists, Tuples, and Nested Data Python practice problems
Ordered collections, mutation, traversal, copying, matrices, and sequence reasoning.
Core concepts
Problem-solving patterns
- list · aggregate
- set · sorting
- deduplication · order
- slicing · modulo
- comprehension · stable order
What this topic builds
Learn the idea once, use it across the exercises, and explain why your approach works.
All 20 problems in this topic
Work from top to bottom to build the concept gradually.
- #093Calculate list sum and average: Daily salesStarterPremium
Summarize several daily sales values.
- #094Calculate list sum and average: Decimal measurementsStarterPremium
Average measurements that contain decimals and a negative correction.
- #095Find largest and second largest: Contest scoresStarterPremium
Report the highest and second-highest distinct contest scores.
- #096Find largest and second largest: Negative valuesStarterPremium
Find the two greatest distinct values in an all-negative list.
- #097Remove list duplicates in order: Clean survey codesBeginnerPremium
Remove repeated response codes without rearranging the first occurrences.
- #098Remove list duplicates in order: Already uniqueBeginnerPremium
Confirm that an already unique list is unchanged.
- #099Rotate a list to the right: Shift duty rosterBeginnerPremium
Rotate a five-person roster two positions to the right.
- #100Rotate a list to the right: Rotation larger than lengthBeginnerPremium
Use modulo when the requested rotation exceeds the list length.
- #101Move zeros to the end: Clean sparse readingsBeginnerPremium
Move missing-value markers to the end while keeping other readings in order.
- #102Move zeros to the end: No zerosBeginnerPremium
Confirm that a dense list remains unchanged.
- #103Merge two sorted lists: Merge rank listsBeginnerPremium
Combine two sorted rank lists into one sorted report.
- #104Merge two sorted lists: Duplicates across listsIntermediatePremium
Keep all occurrences when equal values appear in both inputs.
- #105Find a missing number: Missing attendance IDIntermediatePremium
Find the absent ID among a consecutive class roster.
- #106Find a missing number: Missing boundaryIntermediatePremium
Find the missing final value rather than a value in the middle.
- #107Find two-sum indexes: Price pairIntermediatePremium
Find zero-based indexes of two prices that exactly use a gift voucher.
- #108Find two-sum indexes: Pair containing a negativeIntermediatePremium
Find a target pair when one list value is negative.
- #109Find the maximum subarray sum: Best profit streakIntermediatePremium
Find the largest total across a consecutive streak of daily gains and losses.
- #110Find the maximum subarray sum: All lossesAdvancedPremium
Return the least negative single day when every value is negative.
- #111Transpose a matrix: Rectangular tableAdvancedPremium
Turn a 2-by-3 table into a 3-by-2 table.
- #112Transpose a matrix: Single rowAdvancedPremium
Transpose a one-row matrix into a one-column result.