Python Practice Problems
Python Practice Problems
Live Python practice problems for data engineer roles with hidden test cases including Unicode, DST, and performance budgets.
945 practice problems matching this filter. Difficulty: easy (183), medium (736), hard (26).
Python (945)
- Activity Time Ledger - easy - Matching activities. One runtime.
- A per-request timeout of 2.0 seconds cancels any fetch that takes longer - medium
- Append "python" to the "languages" list inside the dev dictionary - medium
- Apply De Morgan's Laws - medium
- A Semaphore caps how many fetches run at once - medium
- Assign display_name using 'or' for default value - medium
- A user requests certain columns from a database - medium
- A variable called city is provided - medium
- A variable called filename holds "photo.png" - medium
- A variable called phone holds "(555) 867-5309" - medium
- A variable called text holds "Hello World" - medium
- A variable called text holds "programming" - medium
- A variable called word holds the string "developer" - medium
- Batch Partitioner - medium - One pile becomes many. Split wisely.
- Batch Records - medium - Too many at once. Break them into groups.
- Batch With Metadata - easy - The list gets chopped.
- Build a data query pipeline: filter to only in-stock products, sort by price descending, and take th - medium
- Build a decision table mapping (is_member, total >= 100) tuples to discount percentages - medium
- Build a lookup dictionary from a list of user dicts, indexed by email, using a dict comprehension - medium
- Build a prefix sum array from [3, 1, 4, 1, 5] - medium
- Build a value-to-index map from the list ['apple', 'banana', 'cherry', 'date'] using a dict comprehe - medium
- Caesar Shift Check - easy - The key turns. Does it open?
- Calculate the total by adding bill_amount and tip_amount. - medium
- Calculate total discrepancies: the count of IDs that appear in only one database. - medium
- Calculate total elements in the matrix by summing the length of each row. - medium
- Calculate total_saved by summing the difference between original and discounted prices. - medium
- Call analyze_text with 'Python is a great language' and unpack the three return values into variable - medium
- Call the handler function retrieved from the dispatch dictionary. - medium
- Categorize the variable `age` into life stages using if-elif-else: print "child" if age < 13, "teen" - medium
- Character Occurrence Map - easy - Character frequency as a map.
- Char Profile - medium - Every character in the string tells a story.
- Check if the number 999 exists in both a list and a set containing range(1000) - medium
- Check if the variable `color` equals "blue" - medium
- Check whether a user has all required permissions using the subset operator (<=) - medium
- Check whether 'example' appears in the url using the 'in' operator. - medium
- Check whether the error is within the tolerance and store the boolean result in is_ok. - medium
- Coalesce Fields - easy - Nulls are hiding. Fill them in.
- Column Max - easy - One value rules the column.
- Column Range - easy - From minimum to maximum. What is the spread?
- Column Sum - easy - Add up the column. Every value counts.
- Common Prefix - hard - They all start the same way. How far?
- Compare list and tuple memory sizes and store whether the tuple is more compact as a boolean. - medium
- Compare user lists from two months - medium
- Complete both type-hinted functions: add_numbers returns the sum, make_greeting returns 'Hello, <nam - medium
- Complete calculate_bmi to return the BMI formula: weight divided by height squared, rounded to 1 dec - medium
- Complete classify_number: add a guarded case for even numbers (n % 2 == 0) and a default case return - medium
- Complete classify_temp using early returns: 'freezing' below 0, 'cold' below 20, 'warm' below 30, 'h - medium
- Complete describe_status using match-case: 200 returns 'OK', 404 returns 'Not Found', 500 returns 'S - medium
- Complete double_value: double x locally and print 'Inside: ' followed by the value - medium
- Complete fahrenheit_to_celsius to return the conversion formula: (fahrenheit - 32) * 5 / 9. - medium
- Complete flatten: if an item is a list, recurse and extend the result; otherwise append the item dir - medium
- Complete get_discount by storing the computed rate in the cache before returning it. - medium
- Complete get_first: return 'N/A' if items is None or empty, otherwise return the first element. - medium
- Complete has_even: return True immediately when an even number is found (early return pattern). - medium
- Complete is_sorted: compare consecutive pairs, returning False if any element is greater than the ne - medium
- Complete log_event: when show_level is True, print the message prefixed with the level in brackets. - medium
- Complete normalize_keys: return a new dict with all keys run through _normalize, values unchanged. - medium
- Complete power_cached: on a cache miss, store the computed result - medium
- Complete process_contacts: loop through contacts, keep only those with valid emails, clean the names - medium
- Complete safe_average: after the guard clauses, return the average (sum divided by length). - medium
- Complete safe_get: return the element at the given index inside the try block. - medium
- Complete send_message to conditionally append ' [URGENT]' when urgent is True, and ' | CC: <cc>' whe - medium
- Complete Tag's __enter__ (print opening tag, return self) and __exit__ (print closing tag). - medium
- Complete the grade function: return 'C' for scores from 70 to 79 using a chained comparison. - medium
- Complete the inner add function: add the amount to total and return the new total. - medium
- Complete the inner function to return the greeting and name combined with a comma and exclamation ma - medium
- Complete the inner greet function to return the greeting, name, and punctuation combined. - medium
- Complete the Logger's __exit__ method to print 'Finished' when the with block ends. - medium
- Complete the loop: update smallest whenever you find a number smaller than the current minimum. - medium
- Complete the multiply function to return the product of its two parameters. - medium
- Complete the nested functions: average() returns total divided by number of days (rounded to 1 decim - medium
- Complete the nested functions: is_passing returns True if grade >= threshold - medium
- Complete the O(n) two-sum: check if the complement (target - num) is in the seen set, then add the c - medium
- Complete the recursive case: when an item is a list, add the result of recursing into it to the tota - medium
- Complete the state machine loop: look up the next state from the transitions dict using the current - medium
- Complete the validation by printing f-strings that check code3.isdigit() and code1.isalpha(). - medium
- Complete validate: check if 'name' and 'email' are in the record - medium
- Complete validate_score: after all guard clauses pass, return 'valid: ' followed by the score. - medium
- Compute 2 raised to the power of 8 using the ** operator and store the result in a variable called r - medium
- Convert the page_views list into a set called unique_pages - medium
- Convert the string word to a set of unique characters - medium
- Count the frequency of each word in the list using a for loop and .get(word, 0) + 1 - medium
- Create a copy of base using .copy(), then use .update() to merge overrides into the copy - medium
- Create a `db_config` dictionary with "host" set to "db.example.com", "port" set to 5432, and "name" - medium
- Create a deque from [1, 2, 3] - medium
- Create a deque with maxlen=4 - medium
- Create a deque with maxlen=4 - medium
- Create a dictionary called `medals` where the integer key 1 maps to "Gold", 2 maps to "Silver", and - medium
- Create a dictionary called `pet` with the key "name" set to "Luna" and the key "species" set to "cat - medium
- Create a dictionary called `product` with "name" set to "Laptop", "price" set to 999, and "in_stock" - medium
- Create a dictionary called server with keys 'host', 'port', and 'status' mapped to 'web-01.prod', 80 - medium
- Create a dictionary user with keys 'name' set to 'Ada' and 'age' set to 36 - medium
- Create a frozenset from the list [3, 1, 2, 3, 1] - medium
- Create a global variable total set to 0 - medium
- Create a lambda function called double that takes one argument and returns it multiplied by 2 - medium
- Create a list called foods containing "pasta", "sushi", and "tacos" - medium
- Create a list called profile containing the string "Ada", the integer 30, and the boolean True - medium
- Create a list original = [10, 20, 30] - medium
- Create a list, tuple, dict, and set - medium
- Create a maxlen=5 deque and append 8 events - medium
- Create an empty dictionary called `profile` - medium
- Create an empty dictionary called `scores` - medium
- Create an empty set using the correct syntax (remember, {} makes a dictionary) - medium
- Create a nested list original = [[1, 2], [3, 4]] - medium
- Create a Pipeline dataclass with name, steps (default empty list via field), and retries (default 3) - medium
- Create a set containing the values 5, 10, 15, 5, 10 - medium
- Create a shallow copy of data using .copy() - medium
- Create a single-element tuple called solo containing only the value 42 - medium
- Create a tuple called coords containing the values 10, 20, and 30 - medium
- Create a tuple called db_config storing the host 'db.example.com', port 5432, and database name 'ana - medium
- Create a variable age set to 25 - medium
- Create a variable called age set to 25 and a variable called name set to "Maya" - medium
- Create a variable called city and set it to "Denver" - medium
- Create a variable called city and set it to "Portland" - medium
- Create a variable called lines and set it to the string "Line 1\nLine 2" (using the \n escape sequen - medium
- Create a variable called name and assign it the string "Python" - medium
- Create a variable called year and assign it the integer 2024 - medium
- Create a variable count set to 10 - medium
- Create a variable price set to 40 and a variable tax_rate set to 0.07 - medium
- Create the URL slug by joining slug_words with '-', lowercasing each word. - medium
- Create three variables: count = 7, price = 4.99, and label = "sale" - medium
- Create two Counters: c1 = Counter({'a': 3, 'b': 1}) and c2 = Counter({'a': 1, 'b': 4}) - medium
- Create two Counters: c1 = Counter({'x': 3, 'y': 1}) and c2 = Counter({'x': 1, 'y': 2}) - medium
- Cumulative Sum - medium - The total grows with every row.
- Data Quality Report - hard - The data is not as clean as it looks.
- Deep Flatten - medium - Nested deep. Flatten everything.
- Deep Get - medium - Nested deep. Reach in and grab it.
- Define add_item(item, items=None) that creates a new list if items is None, appends item, and return - medium
- Define a decorator shout(fn) that returns a wrapper which uppercases the return value of fn - medium
- Define a function add(a, b) that returns a + b - medium
- Define a function apply_discount(price, percent) that returns price minus (price * percent / 100) - medium
- Define a function called describe_pet that takes two parameters: name and animal - medium
- Define a function called divide_safe that takes two parameters a and b - medium
- Define a function called full_name that takes two parameters, first_name and last_name, and returns - medium
- Define a function called is_even that takes a number and returns True if it is even, False otherwise - medium
- Define a function called make_greeting that takes a name parameter, creates a local variable greetin - medium
- Define a function called power that takes a base and an optional exponent parameter (default 2) - medium
- Define a function called print_banner that prints '**********' (ten asterisks) - medium
- Define a function called print_divider that prints a line of 15 equals signs - medium
- Define a function called say_hello that prints 'Hello, functions!' on one line - medium
- Define a function called say_hello that prints two lines: "Hello, World!" and "Functions are great!" - medium
- Define a function called square that takes one parameter and returns its square (the number multipli - medium
- Define a function classify_score(score) that returns 'A' if score >= 90, 'B' if score >= 80, 'C' if - medium
- Define a function count_multiples(limit, step) that uses a for loop over range(1, limit + 1) and ret - medium
- Define a function describe(**fields) that prints each 'key=value' line in insertion order - medium
- Define a function double(n) that returns n * 2 - medium
- Define a function first_over(threshold, values) that returns the first value in values greater than - medium
- Define a function first_positive(nums: list) -> int that returns the first element that is greater t - medium
- Define a function format_item(name, qty) that prints the quantity followed by 'x' and the name, like - medium
- Define a function greet(name, greeting="Hello") that returns greeting + ", " + name + "!" - medium
- Define a function greet(name) that prints 'Hello, ' followed by name and '!' - medium
- Define a function label(name: str, tier: str = 'standard') -> str that returns a string like 'Ada [s - medium
- Define a function make_counter() with a docstring 'Counter closure; each call bumps the count by 1.' - medium
- Define a function make_multiplier(factor) that returns an inner function multiply(n) that returns n - medium
- Define a function make_tag(name, count) with a docstring 'Return a label like 3x Widget.' that retur - medium
- Define a function parse_name(full) that splits full on a single space and returns (first, last) - medium
- Define a function running_total(n) using a while loop that starts count at 1 and total at 0 - medium
- Define a function stats(nums) that returns a tuple of (minimum, maximum, average) - medium
- Define a function tax(price: float, rate: float = 0.05) -> float that returns price * rate - medium
- Define a function total(*nums) that returns the sum of all arguments - medium
- Define a function triple(n) with the docstring 'Triple the input value.' that returns n * 3 - medium
- Define a generator countdown(n) that yields n, n-1, ..., 1 using yield - medium
- Define area(w, h) returning w * h - medium
- Define a recursive function factorial(n) with a base case at n <= 1 returning 1, else return n * fac - medium
- Define categorize(score) that returns 'pass' if score >= 60, otherwise 'fail' - medium
- Define compose(f, g) that returns a function applying f(g(x)) - medium
- Define connect(host="localhost", port=5432, ssl=True) that returns host + ":" + str(port) + ":ssl=" - medium
- Define create_user(name, email, role="viewer") that returns a dict with those three keys - medium
- Define get_greeting(name) that returns 'Hello, ' + name (do NOT use print inside the function) - medium
- Define get_stats(numbers) that returns three values: the sum, the length, and the average (sum/lengt - medium
- Define get_user() that returns "Alice", 30, "Seattle", "Engineer" - medium
- Define log_message(level, *messages) that prints each message prefixed with "[LEVEL] " - medium
- Define memoize(fn) that returns a wrapper using a dict cache keyed by the args tuple - medium
- Define show_config(**kwargs) that prints each key-value pair as "key: value" (iterate kwargs.items() - medium
- Define square(n) returning n * n and add_one(n) returning n + 1 - medium
- Define sum_all(*numbers) that returns the sum of all arguments - medium
- Demonstrate O(1) dict lookup vs O(n) list search - medium
- Demonstrate O(1) set membership vs O(n) list search - medium
- Demonstrate the difference between sort() and sorted() - medium
- Detect Cycle in Sequence - medium - Follow the chain long enough and it might loop back.
- Detect Outliers - medium - Most values are normal. Some are suspicious.
- Diagonal Extract - medium - Not every value sits in a row or column.
- Dice Roll Scoring - medium - The pattern rewards the patient.
- Dictionary Key Intersection - medium - Two dictionaries. What do they share?
- Distribute Values Into Container Types - medium - Round-robin the values. Keep rotating.
- Dominant Element - easy - Majority element. Appears more than half the time.
- Encode text to UTF-8 bytes, then decode it back to a string. - medium
- Encode the greeting to UTF-8 bytes - medium
- Even Filter - easy - Only the even ones survive.
- Execution Timer Wrapper - medium - Function wrapped with a timer. Duration captured on exit.
- Explode List - easy - One row holds many values. Unpack it.
- Extract and sum all the digits of the number stored in num - medium
- Extract Domain - easy - The domain is buried in the string.
- Extract Leaf Values - medium - The tree has leaves. Pluck them.
- Find all values that appear more than once in the list - medium
- Find both the minimum and maximum of the list in a single pass using O(1) extra space - medium
- Find Indices - medium - It is in there somewhere. Where exactly?
- Find Mode - medium - One value appears more than the rest.
- Find returning users (the intersection of today and yesterday) using the & operator. - medium
- Find the common elements between two lists using sets for efficient O(n) membership testing - medium
- Find the skills that appear in BOTH the frontend and backend sets using the & operator - medium
- Find the smallest gap between any two numbers in [8, 1, 14, 3, 21] - medium
- First use filter() to keep only users where "active" is True, then use map() to extract their names - medium
- Flatten the 2D list [[1, 2], [3, 4], [5, 6]] into a single flat list using a nested list comprehensi - medium
- Flatten the Feed - easy - Nested lists, all the way down.
- Flatten the Nest - easy - Mixed nesting. One flat list out.
- For each number in the list, print it zero-padded to 5 digits using an f-string with :05d format - medium
- Format: price with commas and 2 decimals, ratio as a percentage with 1 decimal, label right-aligned - medium
- Full Outer Zip - medium - Two sides. No value left behind.
- gather returns results in the ORDER you submitted the tasks, not the order they finish - medium
- Given a = {1, 2, 3, 4} and b = {3, 4, 5, 6}, print the sorted list of elements that are in a or b bu - medium
- Given a = [1, 2, 3, 4] and b = [3, 4, 5, 6], print the sorted list of elements that are in both a an - medium
- Given a = [1, 2, 3] and b = [4, 5, 6], create combined = a + b - medium
- Given a = 1 and b = 2, swap them using tuple unpacking in a single line - medium
- Given a = 3 and b = 4, compute the hypotenuse using a ** 2 + b ** 2 (do not take the square root) - medium
- Given a dictionary of cities and their populations, use a for loop over .values() to calculate the t - medium
- Given age = 16 and has_license = True, print 'can drive' if age >= 16 and has_license is True, other - medium
- Given age = 25 and has_passport = True, using a single compound expression with De Morgan simplifica - medium
- Given age and has_id, use the 'and' operator to check if the user can enter (age >= 21 AND has_id is - medium
- Given a = 'listen' and b = 'silent', determine if they are anagrams by comparing sorted character se - medium
- Given a list of login events events = ['ada', 'linus', 'ada', 'grace', 'linus', 'ada'], build a dict - medium
- Given a list of numbers nums = [7, 2, 5, 3, 8, 1, 4] and k = 3, find the k largest values using heap - medium
- Given a list of product dicts, use a list comprehension to extract the names of all products with a - medium
- Given amount = 1234567.891, print it formatted as a string with a comma thousands separator and exac - medium
- Given apples and oranges, add them together and store the result in a variable called total_fruit - medium
- Given a state machine where transitions is {'idle': 'running', 'running': 'done', 'done': 'done'}, s - medium
- Given a `status` string and two safe values `safe1` and `safe2`, print "alert" if the status does no - medium
- Given a string, build its reverse by starting with an empty string and looping through each characte - medium
- Given a = ["x", "y"] and b = ["z"], create a new list called combined using the + operator to join a - medium
- Given base = [1, 2, 3] and extra = [4, 5, 6], use extend() to add all items from extra into base - medium
- Given blocked_ids = {42, 17, 99, 23} and requests = [12, 17, 5, 99, 42, 7, 23, 100], count how many - medium
- Given colors and sizes, use nested for loops to print every combination in the format 'color-size', - medium
- Given colors = ["red", "green", "blue", "yellow"], create a reversed copy using slice notation [::-1 - medium
- Given colors = ["red", "green", "blue", "yellow", "purple"], print the last item using negative inde - medium
- Given count_str = '7' and word = 'apple', convert count_str to an integer and multiply word by that - medium
- Given defaults = {'theme': 'light', 'font': 12, 'wrap': True} and overrides = {'theme': 'dark', 'tab - medium
- Given events = ['login', 'view', 'login', 'purchase', 'view', 'login', 'view'], use Counter to get c - medium
- Given expr = '(()())', use a list as a stack to determine if the parentheses are balanced - medium
- Given first = 'Ada' and last = 'Lovelace', build full_name by concatenating them with a single space - medium
- Given first_name and last_name, create a variable called full_name by concatenating them with a spac - medium
- Given fruits, use enumerate() to print each fruit with its index in the format 'index: fruit' - medium
- Given grades = ["A", "B", "A", "C", "A", "B", "A"], use .count() to print how many times "A" appears - medium
- Given greeting = 'HELLO' and name = 'world', print greeting.lower() followed by a comma, a space, an - medium
- Given grid = [[0] * 3 for _ in range(3)], set grid[1][1] = 9 and print grid - medium
- Given grid (a list of lists of integers), use nested loops to calculate the sum of all values - medium
- Given groceries = ["milk", "eggs", "bread", "eggs", "cheese"], remove "eggs" from the list and print - medium
- Given ids = [101, 102, 103, 104, 105], write an O(1) lookup that prints ids[0] and ids[len(ids) - 1] - medium
- Given is_active, print its type - medium
- Given is_blocked, use the 'not' operator to determine if the user can_post (the opposite of is_block - medium
- Given is_subscriber, is_banned, and is_admin, a user can access a premium feature if they are a subs - medium
- Given items = [3, 8, 2, 7, 5], write a simple O(n) loop that finds the maximum value without using m - medium
- Given items = ['a', 'b', 'c', 'd', 'e'], implement an O(n) single-pass that builds a reverse list wi - medium
- Given items, initialize last to None before the loop - medium
- Given items = ["pen", "book", "pen", "eraser", "pen"], use .index() to print the index of "book" - medium
- Given items = [], print the first item if the list is non-empty, otherwise print 'empty' - medium
- Given keys and values, use dict() and zip() to create a dictionary called info - medium
- Given labels = ['a', 'b', 'c'] and values = [30, 10, 20], zip them into a list of tuples sorted by v - medium
- Given letters = ["a", "c", "d", "e"], insert "b" at index 1 - medium
- Given letters, build a dictionary called freq that maps each character to how many times it appears - medium
- Given monday = {'ada', 'linus', 'grace'} and tuesday = {'linus', 'grace', 'margaret'}, print the sor - medium
- Given name = 'ada lovelace', print the result of name.title() - medium
- Given name and age, use an f-string to print exactly: My name is Alex and I am 25 years old. - medium
- Given name = 'Grace' and score = 97, use an f-string to print 'Grace scored 97 (perfect)' when score - medium
- Given names = ['Ada', 'Linus', 'Grace'] and scores = [95, 82, 91], use zip and enumerate (starting a - medium
- Given names and scores, use zip() to pair them and print each pair in the format 'name: score', one - medium
- Given names, use a for loop to build a new list called upper_names containing each name converted to - medium
- Given nested = [[1, 2], [3, 4, 5], [6]], flatten it into a single list using a list comprehension - medium
- Given nested = {'team_a': [1, 2, 3], 'team_b': [4, 5]}, use a dict comprehension to build a new dict - medium
- Given number = 14, print 'even' if number % 2 == 0, otherwise print 'odd' - medium
- Given nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], print every other item starting from index 0 using a st - medium
- Given nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], use a dict to count occurrences in a single pass (O(n)) - medium
- Given nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], build a list of squares of even numbers using a list c - medium
- Given nums = [1, 2, 3, 4, 5, 6, 7, 8], use filter and a lambda to keep only odd numbers, then print - medium
- Given nums = [1, 2, 3, 4, 5, 6], build a list of squares of even numbers using a list comprehension - medium
- Given nums = [1, 2, 3, 4, 5, 6], use any() to check if any element is > 5 (print result), then use a - medium
- Given nums = [1, 2, 3, 4, 5, 6], use filter with a lambda to keep only even numbers, then map with a - medium
- Given nums = [1, 2, 3, 4, 5], use functools.reduce with a lambda and an initial value of 1 to comput - medium
- Given nums = [1, 2, 3, 4, 5], use map and a lambda to square each number, then list() the result - medium
- Given nums = [1, 2, 3, 4, 5], write an O(n^2) pair sum that prints every i + j where i and j are dis - medium
- Given nums = [1, 2, 3], append 4 to the list without assigning the result - medium
- Given nums = [12, 5, 23, 8, 17], print the minimum, the maximum, and the sum, each on its own line. - medium
- Given nums = [1, 3, -2, 5, -1, 4, 6] and window = 3, compute the maximum sum of any 3 consecutive el - medium
- Given nums = [2, 7, 11, 15] and target = 9, find the two indices whose values sum to target using a - medium
- Given nums = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3], print the number of unique values - medium
- Given nums = [3, 1, 4, 1, 5, 9, 2, 6], compute the prefix sum list where prefix[i] = sum(nums[:i+1]) - medium
- Given nums = [3, 7, 2, 8, 5], use a list comprehension with the walrus operator to capture only elem - medium
- Given nums = [4, 1, 5, 2, 7, 3, 6], use sorted() (which is O(n log n)) to sort them ascending and pr - medium
- Given nums = [4, 1, 7, 2, 9, 3, 8, 5, 6], print the top 3 values sorted descending using slicing on - medium
- Given nums = [4, 7, 2, 9, 3, 8], filter to only even numbers, then sum those - medium
- Given nums = [5, 2, 9, 1, 7, 3, 8], use heapq.nlargest to print the top 3, then heapq.nsmallest to p - medium
- Given nums = [8, 3, 5, 1, 9, 2, 7], use a lambda with sorted() to sort by the absolute difference fr - medium
- Given nums, use a for-else loop to search for the first negative number - medium
- Given nums, use a for loop to calculate the sum of all numbers - medium
- Given nums, use a for loop to count how many values are greater than 5 - medium
- Given nums, use a for loop with break to find the first negative number and print it - medium
- Given nums, use a for loop with continue to skip negative values - medium
- Given n, use a for-else loop to check if n is prime - medium
- Given n, use a while loop to count down from n to 1, printing each number on its own line - medium
- Given op = 'add', x = 10, y = 4, use a dict that maps 'add', 'sub', 'mul', 'div' to lambdas - medium
- Given original = [10, 20, 30], create an independent copy using .copy() and store it in a variable c - medium
- Given pairs = [('ada', 95), ('linus', 82), ('grace', 91), ('margaret', 78)], filter to scores >= 90 - medium
- Given password_length, store whether the password is long enough (>= 8 characters) in a variable cal - medium
- Given path = '/home/user/report.csv', print True if path endswith '.csv' and False otherwise - medium
- Given payload = {'user': 'ada', 'scores': [10, 20, 30], 'meta': {'active': True}}, convert it to a J - medium
- Given planets = ["Mercury", "Venus", "Earth", "Mars"], print the third planet using index 2, then pr - medium
- Given price and discount, subtract the discount from the price and print the result. - medium
- Given price, apply a $5 discount by subtracting 5 from price - medium
- Given prices = [5, 10, 15, 20, 25], loop through each price and append it to a new list called doubl - medium
- Given prices = {'apple': 2, 'banana': 1, 'cherry': 4}, iterate over .items() and print a line like ' - medium
- Given raw = ' Ada Lovelace ', strip whitespace, replace spaces with underscores, and print the res - medium
- Given raw = 'apple, banana , cherry,grape', split on comma, strip each piece, and print the cleaned - medium
- Given raw_tags = ['py', 'sql', 'py', 'go', 'sql', 'py'], build a dict called counts where each key i - medium
- Given raw = ['x', 'y', 'z', 'x', 'y'], build a set from raw and store it in unique - medium
- Given readings = [3.1, -2.4, 5.0, -1.8], compute the sum of absolute values using abs() in a loop - medium
- Given records = [('a', 1), ('b', 2), ('a', 3), ('b', 4), ('a', 5)], group values by key into a dict - medium
- Given records = [('a', 1), ('b', 2), ('a', 3), ('b', 4), ('a', 5)], use collections.defaultdict(list - medium
- Given records = [('Ada', 36), ('Linus', 54), ('Grace', 85)], loop through records and print a line l - medium
- Given required = {'python', 'sql'} and have = {'python', 'sql', 'go'}, print True if required is a s - medium
- Given result and value, use the 'is' operator to check if each variable is None - medium
- Given rows = [[1, 2], [3, 4], [5, 6]], iterate with nested loops to build a list called flat - medium
- Given score = 73, print 'excellent' if score >= 90, 'good' if score >= 75, 'pass' if score >= 60, ot - medium
- Given score = 78, use a ternary expression to assign label = 'pass' if score >= 70 else 'fail' - medium
- Given score, increase it by 15 and print the new value. - medium
- Given scores = [88, 92, 75, 95, 83, 90, 87], print the last 3 scores using a negative-index slice - medium
- Given scores (a dictionary of name:score pairs), use a for loop with .items() to print only the name - medium
- Given score, use if/elif/else to assign a letter grade: "A" if score >= 90, "B" if >= 80, "C" if >= - medium
- Given seen_users = frozenset({'ada', 'linus', 'grace'}), try to add a user (this would fail on a mut - medium
- Given settings = {'theme': 'dark', 'font_size': 14} - medium
- Given sorted_nums = [1, 2, 4, 5, 7, 9, 11] and target = 9, use the two-pointer technique to determin - medium
- Given sorted_nums = [1, 3, 7, 12, 18, 25, 33, 40, 55, 68, 82], implement O(log n) binary search for - medium
- Given sorted_nums = [1, 4, 7, 12, 18, 23], use bisect.insort to insert 10 - medium
- Given stack = ["first", "second", "third", "fourth"], use pop() with no argument to remove and print - medium
- Given start, use a while loop to double start repeatedly until it is greater than or equal to 100 - medium
- Given status = 'error', print 'ok' for 'success', 'retry' for 'pending', 'stop' for 'error', and 'un - medium
- Given students = [('Ada', 95), ('Linus', 82), ('Grace', 91)], use enumerate to print a line like '1 - medium
- Given tasks, use enumerate() with start=1 to print a numbered task list - medium
- Given temperature = 72, print 'comfortable' if 65 <= temperature <= 75, otherwise print 'uncomfortab - medium
- Given temperature, print whether temperature equals 100 using the == operator. - medium
- Given temperature, print whether temperature is greater than or equal to 70 on the first line, then - medium
- Given temps = [72, 68, 75, 80, 85, 78, 70, 73], use slicing to extract items at indices 2 through 5 - medium
- Given the `book` dictionary, print the title and the year on separate lines. - medium
- Given the `colors` dictionary, check if the value "blue" exists among the dictionary's values and pr - medium
- Given the `contact` dictionary, check if the key "phone" exists and print the result - medium
- Given the decimal string score_text, convert it to an integer by first converting to float, then to - medium
- Given the integer count, build a message by concatenating "Found " + the count converted to a string - medium
- Given the `inventory` dictionary, use .pop() to remove the key "banana" and store the removed value - medium
- Given the list [1, 2, 2, 3, 3, 3, 4], use a frequency dict to find all elements that appear more tha - medium
- Given the list `fruits`, use a dictionary called `counts` to count how many times each fruit appears - medium
- Given the list items, convert it to a set to find the unique values - medium
- Given the list numbers, use a list comprehension with a ternary expression to create a list called s - medium
- Given the list nums, use extended unpacking to capture the first element in 'first', the last elemen - medium
- Given the list of coordinate pairs (as lists) called points, convert each inner list to a tuple and - medium
- Given the list page_views, use a set to count how many unique pages were viewed - medium
- Given the list temps representing daily temperatures, find and print the lowest temperature, the hig - medium
- Given the list valid_codes as a list, convert it to a set called valid_set - medium
- Given the list 'values', loop through each and print "T" if the value is truthy or "F" if it is fals - medium
- Given the list words and the dictionary config, print the length of each on its own line - medium
- Given the `server` dictionary, print the host and port values on separate lines. - medium
- Given the set animals, remove 'cat' using .remove() - medium
- Given the set fruits, use .update() to add all items from the list new_fruits - medium
- Given the `settings` dictionary, use `del` to remove the "debug" key - medium
- Given the string age_text, convert it to an integer using int() - medium
- Given the tuple record containing a name, age, and job title, unpack it into three variables: name, - medium
- Given the tuple scores, calculate the average by dividing sum() by len() - medium
- Given the `user` dictionary, add a new key "city" with value "Denver" - medium
- Given the variable language, use an f-string to print exactly: I am learning Python - medium
- Given the variable score, reassign it to 95 and print the updated value. - medium
- Given the variable temperature, write an if/elif/else chain: print "Hot" if temperature is 30 or abo - medium
- Given tokens = ['2026', '04', '22'], join them with '-' to build a date string - medium
- Given total_minutes = 275, use divmod to split it into hours and minutes in one expression - medium
- Given total_minutes, use floor division (//) to calculate whole_hours and modulo (%) to calculate re - medium
- Given total_seconds = 305, compute minutes as total_seconds // 60 and seconds as total_seconds % 60 - medium
- Given two lists a = [1, 2, 3, 4, 5] and b = [3, 4, 5, 6, 7], find common elements in O(n + m) using - medium
- Given two point values point_a and point_b, calculate the absolute distance between them using abs() - medium
- Given user = None and default_name = 'guest', use the or operator to assign name = user or default_n - medium
- Given users = [{'name': 'Ada', 'age': 36}, {'name': 'Linus', 'age': 54}, {'name': 'Grace', 'age': 85 - medium
- Given vals = [42, 17, 93, 8, 56], use the sorted() function to create a new sorted list called sorte - medium
- Given value = None, print True if value is None, then print False if value is not None - medium
- Given values = [3, 8, 1, 9, 4, 7], print the average as a float - medium
- Given words = ['apple', 'banana', 'cherry', 'avocado', 'grape', 'date'], build a set comprehension o - medium
- Given words = ['apple', 'bat', 'cherry', 'date'], build a dict where each key is the word and each v - medium
- Given words = ['apple', 'bat', 'cherry', 'date', 'elderberry'], count how many have length 5 or more - medium
- Given words = ["banana", "fig", "apple", "cherry"], use sorted() with key=len and reverse=True to so - medium
- Given words = ['cherry', 'apple', 'fig', 'banana'], sort them by length ascending, breaking ties alp - medium
- Given words = 'the quick brown fox jumps over the lazy dog the fox'.split(), use collections.Counter - medium
- Given words, use enumerate() to find the indices of all words that have more than 4 characters - medium
- Given x and y, check if x is greater than y and print the result. - medium
- Given x and y (integers) and a and b (strings), print x + y on one line and a + b on the next to see - medium
- Given x (set to None), print the result of x == 0 on the first line and x is None on the second line - medium
- Greeting Formatter Class - easy - First impressions are formatted carefully.
- Group Average - hard - Same group, different values. What is typical?
- Group By - medium - Same key, different rows. Bring them together.
- Group the items by category using dict.setdefault() - medium
- Implement a simple traffic light state machine using a dictionary - medium
- Implement a sliding window to find the maximum sum of any 3 consecutive numbers in the list [2, 1, 5 - medium
- Implement memoized Fibonacci using a dictionary cache - medium
- Implement the two_sum function using a dictionary - medium
- Import bisect - medium
- Import copy and create a deep copy of original = [[1, 2], [3, 4]] - medium
- Import copy and use deepcopy to create an independent copy of original = {'name': 'Alice', 'scores': - medium
- Import heapq - medium
- Import json - medium
- Insert 'd' into the LRU cache, then evict the least-recently-used entry using popitem(last=False). - medium
- Iterate over range(1, 11) - medium
- Iterate over the list [10, 20, 30, 40, 50] in reverse using reversed() - medium
- Join the letters list with no separator to form a word - medium
- Join the path_parts list into a Unix-style file path using "/" as the separator - medium
- Lag Column - medium - What came before this row?
- Left Join - medium - Keep the left side. Match what you can.
- Loop through settings using .items() and print each key-value pair in the format "key -> value", one - medium
- Loop through the metrics dictionary using .items() and print each entry in the format 'key: value%' - medium
- Loop through the ops dictionary, call each function with 5, and print the operation name and result. - medium
- Majority Event in Stream - medium - One event type is drowning out the rest. Find it without a frequency table.
- Make a deep copy of original, modify the copy's first sublist, and confirm the original is unchanged - medium
- Map each workload to the right execution model - medium
- Max Length Token - medium - The longest token wins.
- Merge Counters - medium - Two tallies. Combine them.
- Merge Intervals - hard - Overlapping ranges. Merge them.
- Merge Overlapping Time Ranges - medium - Intervals piling up. Clean the timeline.
- Model why async helps I/O-bound work - medium
- Normalize Name - easy - Names are messy. Standardize them.
- No Shortcuts - easy - The peak value. Built-ins off the table.
- Null Counter - easy - How many holes in the data?
- Ordered Character Check - easy - Check if all As appear before all Bs.
- Palindrome Hunt - medium - It reads the same both ways. Go further.
- Parse Log Line - medium - One line. A dozen fields hidden inside.
- Parse the log entry by splitting on ":" with maxsplit=2 to extract exactly 3 parts: the level, the t - medium
- Permissions Manager - medium - Manage user permissions with config updates.
- Pivot Records - hard - Long format is easy. Wide format is useful.
- Portfolio Profit Calculator - medium - Portfolio gain from purchase history and current prices.
- Precision and Recall - medium - Precision and recall. Both matter.
- Prefix Based Word Replacement - medium - Every word trimmed to its root.
- Print event totals from most_common() as a dict, then print each user's actions sorted by user id. - medium
- Progress Milestones - easy - Progress at every 10% increment. Keep the receipts.
- Quality Gate - easy - Not everything passes inspection.
- Quantile Calculator - easy - Mark the boundary value at a given point.
- Rank Metrics - medium - Not all numbers are equal. Rank them.
- Every Line on the Receipt - medium - Nested deep inside the receipt. Pull every item out.
- Record Filter - easy - Some records belong. Others do not.
- Rename Keys - medium - Old names out. New names in.
- Replace an if/elif chain with dict-based dispatch - medium
- Retrieve 'result_data' from the dict using k2 (an identical but separate instance from k1) as the ke - medium
- Reverse Field - easy - Flip it. See what happens.
- Rotate Buffer - medium - The buffer is full. Rotate it.
- Row Aggregates - medium - Each row holds its own summary.
- Run Length Encoding - easy - AAABBB becomes 3A3B. Compress it.
- Running Distinct Count - medium - New values keep appearing. Track the count.
- Safely delete keys from a dict during iteration - medium
- Safely remove all even numbers from the list [1, 2, 3, 4, 5, 6, 7, 8] by iterating over a copy (list - medium
- Sanitize Field - easy - Dirty input. Clean output.
- Schema Checker - easy - The schema says one thing. The data says another.
- Sequential Word Pairs - easy - Everything has a neighbor.
- Set counter = 0 at the module level - medium
- Set x = 100 at the module level - medium
- Shortest Unique Metric Tag - medium - One token per metric. Make it unambiguous.
- Show that .copy() is shallow: create original = {'items': [1, 2, 3]}, make a shallow copy with .copy - medium
- Show that frozenset operations return new frozensets - medium
- Show that sort() returns None - medium
- Show the multiplication trap: create wrong = [[0] * 3] * 3, set wrong[0][0] = 1, and print wrong - medium
- Show the mutable default argument bug: write a function add_to(item, bag=None) that safely creates a - medium
- Simplify boolean expressions - medium
- Single Element Among Pairs - easy - One element has no partner.
- Sort Descending - easy - Biggest first. No exceptions.
- Sort the employees list by salary in descending order using sorted() with a lambda as the key - medium
- Sort the employee tuples by department ascending, then by salary descending within each department - medium
- Sort the list [4, 2, 7, 1, 3, 7, 2] and find all duplicates by comparing adjacent elements - medium
- Sort the list of student tuples by their score (the second element) using sorted() with a lambda key - medium
- Sort the list of words by their length (shortest first) using sorted() with a key function - medium
- Sort the scores in descending order and print only the top 3 scores using slicing. - medium
- Sort the students by grade ascending, then by score descending (highest first), then by name ascendi - medium
- Split the CSV header on ',' and rejoin with tabs - medium
- Split the multiline text into individual lines using splitlines() - medium
- Start with all_tasks and use the - operator to remove completed and blocked tasks in a chain - medium
- Start with an empty list called doubles - medium
- Start with an empty list called nums - medium
- Start with an empty set called colors - medium
- Start with count = 1 - medium
- Start with inventory = {'apple': 3, 'banana': 5, 'cherry': 7} - medium
- Start with items = ['apple', 'banana'] - medium
- Start with seen = set() - medium
- Start with tags = {'python', 'sql', 'go', 'rust'} - medium
- Start with tasks = ['email', 'meeting', 'lunch', 'review'] - medium
- Stock Range Finder - medium - Prices move. One stretch had the widest gap.
- Store the result of calling get_message() (with parentheses) in result2 - medium
- Store three functions in a list: one that adds 1, one that doubles, one that squares - medium
- Stream-Process a Large CSV - hard - Too big to load. Read what you can.
- Strip whitespace from raw, replace 'World' with 'Python', and print the result and its length. - medium
- Subarray Signal - medium - One stretch carries the strongest signal.
- Swap the values of x and y using only arithmetic (addition and subtraction) with no temporary variab - medium
- The Account Manager - easy - Deposits, withdrawals, and the risk of going negative.
- The Additive Chain - easy - Each value is the sum of the two before it - no calls to itself allowed.
- The Address Surgeon - easy - One string hides a street, a city, a state, and a zip.
- The Alphabet Score - easy - Every letter has a secret numeric value - what's your total?
- The Alphabet Sorter - easy - Filing cabinet logic: everything goes in its proper drawer.
- The Anomaly Detector - hard - Spot the outliers before they page someone.
- The Balanced Inspector - medium - Every branch should carry the same weight.
- The Balanced Sum - easy - Some numbers have a rare quality that mathematicians revere.
- The Bipartite Test - medium - Can this crowd be split into two perfectly separated groups?
- The Bit Counter - easy - How many lights are on in the binary representation?
- The Bit Ladder - easy - Count the ones all the way up.
- The Bit Reverser - medium - Sometimes the answer is literally backwards.
- The Bitwise Judge - easy - No division, no modulo - just a single bit tells you everything.
- The Blind Multiplier - medium - Compute the result of everything around you - without seeing yourself.
- The Bonus Round - medium - Consecutive matching dice rolls trigger a special scoring rule.
- The Bouncer - easy - Every door has a guest list.
- The Bracket Validator - easy - Brackets opened and closed. The nesting might be off.
- The Bronze Medalist - easy - Not first, not last - somewhere in the middle of the podium.
- The Budget Allocator - medium - Split the money. Some wore two hats.
- The Bug Spotter - easy - It compiles. The answer is still wrong.
- The Build Order - medium - Some tasks must wait for others to finish first.
- The Calendar Sort - easy - Time has its own opinion about order.
- The Carousel - easy - Keep moving, same ride.
- The Category Ranker - medium - Categories have standing. Rows get theirs.
- The Chain Builder - medium - Links connect in sequence - build the chain from scratch.
- The Chain Transform - medium - One small step at a time can cover a great distance.
- The Change Data Capture - hard - Inserts, updates, deletes : all present.
- The Change Tracker - medium - Before and after snapshots. The delta is in there.
- The Character Clans - medium - Words sharing the same letters belong to the same clan.
- The Character Encoder - easy - Squeeze a string down to its tightest form.
- The Character Map - easy - Character-level frequency. As a dictionary.
- The Chunked Reader - medium - Too big for memory. Read in pieces.
- The Cipher Wheel - easy - Every letter has an alias - you just need the right codebook.
- The Clock Angle - easy - Two hands. One gap. One number.
- The Clock Examiner - medium - Two hands on a clock - how wide is the gap?
- The Code Expander - easy - Compressed messages need a decoder to come alive.
- The Coin Vault - medium - Exact change only - and you want to use as few coins as possible.
- The Column Shuffle - medium - Rows in, columns out. Number them.
- The Column Transformer - easy - Each column gets its function.
- The Column Zipper - easy - Headers on top, values below, dict in the middle.
- The Complement Hunt - easy - Every number is looking for its other half.
- The Config Blender - easy - Config collision. The surviving values after a merge.
- The Consecutive Sequence Finder - medium - Numbers that flow without interruption.
- The Consecutive Streak - medium - Login streaks. No gaps allowed.
- The Counting Machine - medium - It knows where it stopped last time.
- The Crowd Favorite Eatery - easy - One restaurant clearly won the most hearts.
- The Crowd Pleaser - easy - One value shows up more than all others combined.
- The Crowd Splitter - easy - The middle holds even with a dominant outlier.
- The Custom Iterator - medium - Some sequences follow their own rules.
- The Cycle Detector - medium - Follow the chain long enough and you might end up where you started.
- The DAG Executor - hard - Wire up a mini pipeline and watch it run.
- The data dict has a "user" key with a nested dict containing "name", but no "email" key - medium
- The Date Sorter - medium - Jumbled calendar. Sort it first.
- The Decomposer - easy - Every composite thing can be broken down to its simplest parts.
- The Deep Config - medium - Nested config, dot-notation output.
- The Deep Dictionary - easy - One key goes further than the rest.
- The Deep Dive - easy - A specific position in the unsorted pile.
- The Deep Selector - easy - Tell it what you want. It knows where to look.
- The Deep Unpacker - easy - Boxes inside boxes. Eventually you reach the bottom.
- The Dependency Resolver - medium - Everything depends on everything.
- The Depth of Field - easy - Some containers hold containers that hold containers.
- The Diagonal Accountant - easy - Two diagonals cross in the center of every square.
- The Dict Comparator - medium - Two dictionaries. Subtle differences.
- The Dictionary Inverter - easy - Flip the dict. Group what used to be values.
- The Dominant Signal - easy - Hottest items in the transaction log. Ties included.
- The Double-Ended Gateway - medium - Some queues let you skip the line from both ends.
- The Duplicate Spotter - easy - Some values appear more than once - report only those.
- The Dynamic Container - hard - Build your own resizable list with no help from the standard library.
- The Elevator Trace - medium - Nested floors. One path through.
- The Email Ranker - medium - Some inboxes see more action.
- The Encoded Signal - medium - The encoding is hiding multipliers. Decode it.
- The Even Checkpoint - easy - Is this number in the even club? Prove it the fast way.
- The Event Aggregator - medium - Bucket a firehose of events into tidy time windows.
- The Event Broadcaster - medium - Subscribers show up, listen, and sometimes leave.
- The Event Bucketer - easy - Logs slotted into buckets.
- The Event Overlap Detector - medium - Overlapping events. The calendar knows.
- The Event Window - medium - A five-minute window is all that matters.
- The Eviction Policy - medium - Fixed capacity. Oldest unused entry gets evicted.
- The Exception Handler - medium - Good code handles failure as gracefully as success.
- The Expander - easy - What goes in small comes out big.
- The Face That Breaks the Bank - medium - Roll enough dice and one number always runs away with it.
- The Family Reunion - medium - Two cousins share a common ancestor somewhere above.
- The Fast Climber - medium - Some routes up the mountain are faster than others.
- The Field Counter - easy - Some fields speak louder than others.
- The File Size Profiler - medium - File types and their disk footprint. One type dominates.
- The File Tree Builder - medium - Flat paths. Build the nested tree.
- The First Class Function - medium - Functions travel as values - prove you can pass one around.
- The First Encounter - easy - Every character has a story - but only if you remember where it started.
- The First Stranger - easy - In a crowd, the unique ones stand out first.
- The Flat Mapper - medium - Nested values. One flat stream out.
- The Forbidden Ceiling - easy - Round up. But not the obvious way.
- The Forbidden Sorter - medium - Put the letters in order without the obvious tool.
- The Forgetful Machine - medium - It remembers everything, until it does not.
- The Forward Fill - easy - Patch the gaps in a noisy sensor stream.
- The Frequency Eviction - hard - When storage is tight, something has to go.
- The Gap Filler - easy - Fill the Nones with the last real value.
- The Gap Reporter - medium - The missing IDs in the log - somebody has to notice.
- The Gate Keeper - easy - Not all openings have a closing.
- The Generous Ones - medium - The generous ones are obvious.
- The Genre Filter - medium - Three tables, two conditions, one actor's total.
- The Grid Pivot - easy - A different angle reveals a completely different picture.
- The Half-Life Search - medium - Every guess cuts the problem in half.
- The Halftime Score - easy - Middle value of a dataset. No built-in shortcuts.
- The Hash Stamper - easy - One input, one irreversible output - the foundation of every secret.
- The Hierarchy Builder - hard - Parent-child pairs, flat. Build the family tree.
- The High Mark - easy - Scan the list. Report the max.
- The High Rollers - medium - Not every gambler bets the same - some wager far more than others.
- The Horizon Scanner - medium - For each position, what is coming up ahead?
- The Hostile Takeover - medium - One dict eats another.
- The Host Ranker - medium - Some hosts have more to offer.
- The Hourly Bucket - medium - Timestamps belong somewhere.
- The Impersonator - medium - You only have stacks. Make a queue anyway.
- The Indivisibles - easy - Numbers that yield only to themselves.
- The Infection Spread - hard - It starts with one, and then it spreads.
- The Integer Sieve - easy - Not everything in this list belongs here.
- The Intervals - medium - Timestamps in buckets.
- The Inverted Triangle - medium - A pattern of stars narrows toward the bottom.
- The IP Validator - easy - Real and fake, mixed together.
- The Island Counter - medium - Surrounded by water, connected by land - how many separate landmasses?
- The Last Instance - easy - When duplicates appear, only the last one counts.
- The Last Seen Map - easy - For each character, where did it appear last?
- The Lazy Squares - easy - A sequence that never fully reveals itself.
- The Lazy Stream - hard - Yield values one at a time from a potentially infinite source.
- The Lazy Unpacker - medium - Instead of loading it all at once, yield it one piece at a time.
- The Letter Census - easy - Every crowd has its share of talkers and quiet ones.
- The Letter Frequency Map - easy - Count every character in the string and report the results.
- The Letter Kin - medium - Words that share the same letters belong together.
- The Letter Ledger - easy - Every character has a count to answer for.
- The Letter Mapper - medium - A consistent substitution, or not.
- The Letter Tally - easy - Each character in the string has a count to answer for.
- The Level Inspector - medium - Each floor of the tower tells a different story.
- The Level Summer - medium - Add up each level of the tree.
- The Line Cutter - easy - Did everyone with an A-pass get through before the B-crowd arrived?
- The Line Splitter - easy - Comma-separated truths, one at a time.
- The Link Shrinker - medium - Long addresses have aliases - you give them out, you keep the map.
- The List Merger - easy - No shortcuts.
- The Load Balancer - medium - Distribute incoming requests evenly across available servers.
- The Log Decoder - easy - Every line holds a secret.
- The Log Pulse - easy - Some lines repeat themselves.
- The Lone Character - easy - It appeared exactly one time. That made it special.
- The Lone Traveler - easy - One character stands apart from the crowd.
- The Manual Sorter - easy - No shortcuts, no built-ins, just work.
- The Map Reducer - medium - Map it. Reduce it. One answer.
- The Market Streak - medium - Some stocks run longer than you think.
- The Market Timer - medium - One buy, one sell - when do you make the most?
- The Matching Manifest - easy - Two warehouses, one shipment - only load what's in both.
- The Median Keeper - hard - The middle value keeps moving as new data arrives.
- The Meeting Room Allocator - hard - Meetings overlap on the calendar. Rooms are limited.
- The Merge - easy - Chaos in. Order out.
- The Merge Champion - medium - Many sorted rivers flowing into one.
- The Messy Pipeline - easy - The upstream API has no idea what a schema is.
- The Middle Ground - hard - The middle value keeps moving.
- The Min Tracker - medium - The stack remembers the best it ever saw.
- The Minutes Tracker - easy - Some activities eat more time than others.
- The Mirror Flip - easy - Sometimes the fastest fix is to swap everything.
- The Mirror Image - easy - Flip the tape backwards - start from the end.
- The Mirror Test - easy - Check if a string reads the same forwards and backwards.
- The Mirror Words - easy - Each word looks back at itself.
- The Missing Number - easy - Something is missing from the sequence.
- The Molecule Report - easy - Four letters. A lot of math hidden in the sequence.
- The Month-by-Month Snapshot - medium - Every salesperson has a story. The months just tell it sideways.
- The Mountain Peak - medium - The sequence has a summit.
- The Multiplication Trail - easy - Each step multiplies the whole journey.
- The Multiplier Rush - medium - Negatives cancel negatives - but only if you keep both in view.
- The Narrow Lens - medium - A narrow timeframe. Everything inside matters.
- The Nearest Value Mapper - medium - Close enough counts. Ties go low.
- The Never-Ending Sequence - easy - Sequence that keeps going. Follow it.
- The Numbered Chair - easy - A standing list. Position n holds one entry.
- The Number Miner - medium - JSON strings are hiding numeric secrets - dig them out.
- The Number Narrator - medium - Every number has a story in words.
- The Number Screen - easy - Some numbers make the cut. Most do not.
- The Odd Digits - easy - Hidden inside a mess of characters are a few odd numbers.
- The Odd Extractor - easy - Not all numbers from a string are welcome here.
- The Odd Filter - easy - Strip out everything that does not belong to the odd club.
- The One-of-Each - easy - Strip the repeats, keep the originals.
- The One-Timers - easy - Values that never repeated.
- The One-Way Street - easy - Monotonic time-series. Direction only.
- The Onion Layer - hard - Peel from the outside in - one ring at a time.
- The Online Elite - medium - The top performers are hiding in the data.
- The OOP Pillars Exam - medium - Four principles, one class hierarchy - show you know all of them.
- The Op Dispatcher - easy - Name the operation, apply it everywhere.
- The Order Enforcer - easy - Some rules say every A must come before every B.
- The Order Inspector - medium - A binary tree has rules - is this one actually following them?
- The Original Keeper - easy - Clean up duplicate events without losing the timeline.
- The Output Peak - hard - One stretch outpaced all the others.
- The Overlap Finder - easy - Two guest lists - who made it onto both?
- The Page Turner - medium - Nobody loads everything at once.
- The Pair Counter - easy - How many pairs can be formed from the crowd?
- The Paired Doors - easy - Every open bracket has a partner - but not every partner shows up.
- The Pandas Pivot - medium - Rows become columns. Columns become power.
- The Parentheses Factory - medium - Building balanced brackets is an art form.
- The Pascal Row - easy - Each number is the sum of two numbers above it.
- The Password Builder - easy - Random characters, fixed rules.
- The Password Forge - easy - Does this password pass the strength gate?
- The Pay Ladder - medium - Climb the ladder the hard way. No shortcuts allowed.
- The Payload Flattener - medium - Turn a deeply nested API response into a flat row.
- The Peak Finder - easy - Largest number in the list. Max() is not an option.
- The Perfect Match - medium - Two numbers walk into an interview...
- The Pipeline Filter - easy - In the door as one thing, out the door as another.
- The Placement Fixer - medium - Each value belongs in exactly one spot.
- The Postfix Processor - medium - Math without parentheses - the operators come after the numbers.
- The Precision Hunt - medium - Some answers need no decimal point.
- The Price Bander - easy - Different prices, different treatment.
- The Priority Queue - medium - When two things tie, something has to break the deadlock.
- The Progress Meter - medium - Report progress at every tenth of the way through.
- The Progress Parade - easy - Just tell them how far along you are.
- The Quarter Turn - medium - One rotation changes everything.
- The Queue Disguise - medium - A queue in sheep's clothing.
- The Ranked Dict - easy - Values deserve order too.
- The Record Reconciler - medium - Two versions of the same truth.
- The Repeat Offenders - easy - Repetition is a clue.
- The Repeat Review - medium - The echo came back.
- The Repeat Visitor - medium - Loyal customers come back sooner than expected.
- The Response Aggregator - medium - Multiple result pages. One clean summary.
- The Resume Sifter - medium - Pull what's useful. Skip what you know.
- The Rolling Peak - medium - The sweetest stretch in the sequence.
- The Rolling Window - medium - Smooth things out, one step at a time.
- The Roman Converter - easy - Roman numerals decoded.
- The Rotated Array - medium - Someone shuffled it. Now locate what you came for.
- The Runner-Up - easy - Not the winner. The one just behind it.
- The Running Total - easy - Each position holds the sum of everything before it.
- The Safe Caster - easy - Type conversion is easy, until it is not.
- The Schedule Cleaner - medium - Overlapping sessions. One clean line.
- The Schema Diff - medium - Two versions of the same config - what changed between them?
- The Schema Differ - medium - Schema from yesterday vs today. Something changed.
- The Schema Migrator - hard - Old schema in, new schema out.
- The Scoreboard Race - medium - Simulate rounds until someone hits the target.
- The Score Sorter - easy - Points on the board, sorted by who earned the most.
- The Scramble Check - easy - Same letters, different order - are these two strings secret twins?
- The Second Summit - easy - Not the top of the mountain - just below it.
- The Secret Twins - easy - Same letters, different disguises.
- The Self-Portrait Number - easy - Some numbers describe themselves perfectly.
- The Sequel Spotter - easy - Spot the sequels hiding in the catalog.
- The `settings` dictionary has no "theme" key - medium
- The Shadow Cleaner - easy - Remove the repeats. No shortcuts.
- The Shifting Standard - medium - A benchmark in motion.
- The Short Address - medium - Turn a big number into a compact alphanumeric code.
- The Shortest Route - medium - Fewer hops is always better.
- The Silent Locator - easy - Every lookup should cost you less than the one before it.
- The Silver Screen Summit - medium - Box office totals decide who makes the top of the marquee.
- The Single Bit - easy - One particular pattern hides in plain sight.
- The Slow Leak - medium - Nested iterators. One flat stream.
- The Sneaky Twins - medium - They look different but they are the same inside.
- The Social Graph - easy - Everyone knows someone.
- The Solo Act - easy - One-and-done values only.
- The Spin Doctor - medium - Ninety degrees, but which way?
- The Spiral Harvest - medium - The snail reads the grid in its own special order.
- The Spread - easy - Data spread around a center. The range matters.
- The Squeeze - easy - aaabbb gets old fast. Shrink it.
- The Staircase Problem - medium - One step or two, the choices add up.
- The Status Board - medium - Make sense of a pile of raw Nginx access logs.
- The Step Counter - easy - You can hop one step or two - how many ways to reach the top?
- The Streak Breaker - easy - It has a problem with repetition.
- The Stream Averager - easy - The answer moves with the data.
- The Stream Joiner - hard - Events don't wait for each other. This does.
- The String Shrinker - easy - Compress the string. Shorter wins.
- The Style Guide - easy - Not every word deserves the same treatment.
- The Subarray Tally - medium - How many hidden windows hit the target?
- The Syntax Sentinel - easy - Brackets opened and closed. The nesting might be off.
- The Table Thief - medium - Somewhere in that query, tables are hiding.
- The Tag Analyst - medium - Two sets of labels, one analysis.
- The Tail End - easy - Push, pop, peek. The basics that break people.
- The Tail Finder - medium - Navigate to the end of a linked list using recursion.
- The Tail Trimmer - easy - Remove the k-th item from the back without counting forward first.
- The Tally Counter - easy - How many times does a single guest show up to the party?
- The Target Hunt - medium - Pairs that hit a target. Every one of them.
- The Throttle Ceiling - medium - Too many requests in too short a timeframe. Throttle it.
- The Throttle Wall - hard - Stop the abusers. Let the rest through.
- The Timezone Trap - medium - Trip data and timezones. They're not the same thing.
- The Timing Decorator - medium - Wrap any function to capture how long it takes.
- The Title Ladder - medium - Job titles and the salary tier they belong to.
- The Top Reviewer - easy - One restaurant receives the most feedback - which one?
- The Top Words - medium - In every document, some words dominate the conversation.
- The Trade Log Aggregator - medium - Every trade left a footprint.
- The Trade Signal - easy - Buy low, sell high. Identify the ideal moment.
- The Traffic Director - easy - Spread the load evenly - nobody should be doing all the work.
- The Trapped Pool - hard - What collects in the valleys after the rain?
- The Tree Measurer - easy - How deep does the rabbit hole go?
- The Trip Aggregator - medium - Travel records hold patterns waiting to be surfaced.
- The Trip Grouper - easy - Where did everyone go, and for how long?
- The Triple Alliance - hard - Three numbers, one target.
- The Triplet Hunt - medium - Every path that works gets a seat at the table.
- The Type Sorter - easy - A mixed list is hiding its numbers - extract them.
- The user dict has no "role" key - medium
- The Value Sorter - easy - The order was always negotiable.
- The variable count holds the integer 5 - medium
- The variable `number` holds an integer - medium
- The variable phrase holds a string - medium
- The variable price_text holds the string "30" - medium
- The variable raw_name holds a messy name string - medium
- The variable reply holds user input in mixed case - medium
- The variables item and qty are provided - medium
- The variable username holds a string - medium
- The variable word holds "python" - medium
- The Velvet Rope - medium - Some users get in. Others wait outside until the window resets.
- The Version Parade - easy - 1.0 before 2.0. Don't let the dots confuse you.
- The Version Ranker - medium - Software versions follow their own ordering rules.
- The Vocabulary Test - medium - Can you spell out the whole sentence using only the words you know?
- The Vowel Hunt - easy - Just the vowels. All of them.
- The Waiting Game - medium - Patience has a price - and a count.
- The Water Collector - hard - Two walls, one sky, and a very important question.
- The Water Gauge - medium - Elevation bars trap water between peaks - count the volume.
- The Window Cleaner - medium - Keep it fresh, keep it unique.
- The Word Census - easy - Who said what - and how many times?
- The Word Counter - easy - How many times does each word show up in a file?
- The Word Families - medium - Different spellings, same letters - they belong together.
- The Word Flipper - easy - The sentence stays, the words surrender.
- The Word Inventory - easy - Every word, twice over.
- The Word Map - easy - Input text. Output: word frequency.
- The Word Mismatch - easy - Some text does not match.
- The Yahtzee Engine - hard - Five dice. Six faces. Score it.
- The Yahtzee Scorer - medium - Dice scoring. Multiple categories evaluated.
- The Zero Propagator - medium - One zero can change the whole picture.
- The Zigzag Encoder - medium - The message snakes its way across the rails.
- Three project teams each know different languages - medium
- Three teams have overlapping skills - medium
- Threshold Filter - medium - Above the line or below it.
- Tokenize - easy - Split it apart. Keep the pieces.
- Top N Keys - medium - Most of them do not matter. The few that do stand out.
- Transform Column - easy - Same data, new shape.
- Translate this pseudocode to Python: start with a total of 0 - medium
- Transpose Table - medium - Rows become columns. Columns become rows.
- Triangle Validator - medium - Not every triangle is a triangle.
- Two boolean variables are given: `is_logged_in` and `has_permission` - medium
- Two configuration snapshots differ - medium
- Two employees have shift schedules - medium
- Two teams have different skills - medium
- Type Caster - easy - Wrong type. Fix it.
- Unbroken - easy - A single dip resets the clock. Find the longest the machine held over the line.
- Unflatten Keys - medium - Dots in the key names. Rebuild the structure.
- Unique Values - easy - Duplicates are noise. Remove them.
- Use a dict comprehension to invert country_codes (swap keys/values), keeping only countries with nam - medium
- Use a dictionary comprehension to create a dict that maps each integer from 1 to 5 to its cube (n ** - medium
- Use a dictionary comprehension to invert the colors dict by swapping each key with its value - medium
- Use a dictionary comprehension to map each word in the list ['hello', 'world', 'python'] to its leng - medium
- Use a dictionary comprehension with a condition to create a new dict containing only the scores that - medium
- Use a dictionary to count how many times each word appears in the list - medium
- Use a dict to classify HTTP status codes: map 200 to 'OK', 301 to 'Redirect', 404 to 'Not Found', 50 - medium
- Use a for loop over range(1, 6) to compute the sum of 1 through 5 inclusive - medium
- Use a for loop to iterate over range(1, 6) - medium
- Use a for loop with range to calculate the sum of numbers from 1 to 5 (inclusive) - medium
- Use a for loop with range() to print the numbers 1 through 5, each on its own line. - medium
- Use a for loop with .setdefault() to group the words list by each word's first letter - medium
- Use a list as a stack - medium
- Use a list comprehension to create a list of squares for numbers 1 through 6 - medium
- Use a list comprehension to create a list of squares of the even numbers from 0 to 9 (inclusive) - medium
- Use a list comprehension to filter instead of modifying during iteration - medium
- Use a list comprehension with a filter to create a list containing only the squares of odd numbers f - medium
- Use a list comprehension with a filter to keep only the words from the list that have more than 4 ch - medium
- Use 'and' as a guard: 'data and data.upper()' safely skips .upper() when data is None - medium
- Use any() to check if any number in [2, 4, 6, 7, 8] is odd - medium
- Use any() to check if any string starts uppercase, and all() to check if all strings start uppercase - medium
- Use a prefix sum to find the sum of the entire array [10, 20, 30, 40, 50] without re-summing - medium
- Use a set called seen and a list called unique to deduplicate ids while preserving order - medium
- Use a set comprehension to create a set of squares for numbers 1 through 5: {x**2 for x in range(1, - medium
- Use a set comprehension to extract all unique department names from the employee list - medium
- Use a set comprehension with a filter to extract unique even numbers from the list [1, 2, 2, 3, 4, 4 - medium
- Use a set to efficiently deduplicate a list while preserving order - medium
- Use a single chained comparison (x < y < z) to check whether three numbers are in strictly ascending - medium
- Use a sliding window of size 3 to compute moving averages of [10, 20, 30, 40, 50] - medium
- Use a ternary expression to compute abs_n: n if non-negative, else -n. - medium
- Use a ternary to assign label: str(count) + ' items' if count != 1, else str(count) + ' item'. - medium
- Use a while loop to count down from 3 to 1, printing each number - medium
- Use bisect.insort to build a sorted list from the unsorted values [5, 2, 8, 1, 9, 3] - medium
- Use chained bracket access to print the "port" value from inside the "database" nested dictionary. - medium
- Use chained .get() calls to safely extract the city from nested dicts - medium
- Use .copy() to create a copy of original - medium
- Use Counter from the collections module to count the frequency of each word in the list words - medium
- Use Counter to count the characters in 'mississippi' - medium
- Use Counter to count the letters in 'abracadabra' - medium
- Use Counter to find the most common character in 'abracadabra' - medium
- Use defaultdict(int) to count how many times each character appears in the string 'banana' - medium
- Use defaultdict(list) to group the records list by department - medium
- Use defaultdict(list) to group these (category, item) pairs: ('fruit', 'apple'), ('veg', 'carrot'), - medium
- Use defaultdict(list) to group these pairs by the first element: ('a', 1), ('b', 2), ('a', 3), ('b', - medium
- Use defaultdict(set) to track unique visitors per page: ('home', 'alice'), ('about', 'bob'), ('home' - medium
- Use De Morgan's Laws to simplify: not (x > 5 and x < 10) is equivalent to (x <= 5 or x >= 10) - medium
- Use dict() and zip() together to create a dictionary from the keys and values lists - medium
- Use divmod(17, 5) to get the quotient and remainder - medium
- Use enumerate() to loop over the list fruits - medium
- Use enumerate with reversed to print items from ['a', 'b', 'c', 'd'] in reverse with their original - medium
- Use filter() with a lambda for even numbers, then map() with a lambda to square them - medium
- Use filter() with a lambda to keep only positive numbers from [-3, -1, 0, 2, 5, -4, 7] - medium
- Use filter() with a lambda to keep only the even numbers from [1, 2, 3, 4, 5, 6, 7, 8] - medium
- Use filter() with a lambda to keep only the even numbers from the list - medium
- Use .find() to search for 'dog' in the sentence and print the result (returns -1 when not found). - medium
- Use frozensets as dictionary keys - medium
- Use functools.reduce to compute the product of all numbers in [1, 2, 3, 4, 5] - medium
- Use guard clauses with continue to skip records where value is None or negative - medium
- Use heapq.nsmallest and heapq.nlargest to find the 3 smallest and 3 largest values from [15, 3, 28, - medium
- Use 'is not None' to correctly detect that result=0 is a found value (not falsy-failed) - medium
- Use @lru_cache(maxsize=128) to memoize a recursive factorial function - medium
- Use map() to convert the list of string prices to integers, then print their sum. - medium
- Use map() with a lambda to double each number in [1, 2, 3, 4, 5], then use filter() with a lambda to - medium
- Use map() with a lambda to extract just the "name" value from each dictionary in the users list - medium
- Use multiple assignment to set x to 10 and y to 20 on one line - medium
- Use multiple assignment to set x to 5 and y to 10 in a single line - medium
- Use nested if statements to check account access - medium
- Use .pop() to remove and capture the last item from the pipeline list. - medium
- Use range() with a step argument to print all even numbers from 2 to 10 (inclusive), each on its own - medium
- Use selective unpacking with _ placeholders to extract only the grade and major (3rd and 4th values) - medium
- Use set operators to find the intersection (&), union (|), and difference (-) of team_a and team_b - medium
- Use short-circuit evaluation: given x = 5, print the results of (x > 3 or x > 10), (x > 3 and x < 10 - medium
- Use sorted() with a lambda function to sort the list [-3, 1, -2, 4] by absolute value (smallest to l - medium
- Use sorted() with a lambda key to sort the list of tuples [('Charlie', 25), ('Alice', 30), ('Bob', 2 - medium
- Use sys.getsizeof to compare memory usage of a 5-element list [0,1,2,3,4] vs a 5-element dict {0:0,1 - medium
- Use the accumulator pattern: count how many words in the list have more than 4 characters - medium
- Use the filter pattern: create an empty list called big, then loop through values - medium
- Use the modulo operator (%) to check if `number` is even or odd - medium
- Use the &= operator to keep only items present in the intersection set. - medium
- Use the | operator to merge defaults and user_prefs into a NEW dictionary called combined, without m - medium
- Use the * operator to repeat the string "ab" exactly 4 times and print the result. - medium
- Use the 'or' operator to provide default values - medium
- Use the transform pattern to convert each Celsius temperature to Fahrenheit using the formula F = C - medium
- Use the two-pass pattern: first calculate the average of the scores, then build a list of scores tha - medium
- Use the two-pointer technique on a sorted list [1, 3, 5, 7, 9, 11] to find if any two numbers sum to - medium
- Use the walrus operator in a list comprehension: compute x * 3 once with := and filter where the res - medium
- Use the walrus operator in a list comprehension: create squares where (sq := n**2) > 10 - medium
- Use .update() to merge extras into profile - medium
- Use zip() to combine items, prices, and quantities together - medium
- Using collections.deque with maxlen=3, push 1, 2, 3, 4, 5 in order using append - medium
- Using dataclasses.dataclass with frozen=True, define class Point with fields x: int and y: int - medium
- Using functools.lru_cache(maxsize=None), define fib(n) recursively where fib(0) = 0, fib(1) = 1, els - medium
- Validate a data record: check that `name` is not empty AND `age` is between 0 and 150 (inclusive) - medium
- Validate Email - medium - Looks like an email. But is it?
- Value Count - easy - How many of each? Count them.
- Variables first and last hold name parts - medium
- Variables item, price, and qty are provided - medium
- Word Counter - easy - Words in, counts out.
- Write a comment that says "Calculate the area" on its own line, then create a variable called area s - medium
- Write a decorator called 'announce' that prints 'Calling function!' before the decorated function ru - medium
- Write a decorator called call_counter that counts how many times a function is called - medium
- Write a decorator called 'double_result' that doubles the return value of any function it wraps - medium
- Write a function called count_target(items, target) that counts how many times target appears in ite - medium
- Write a function called has_duplicates that takes a list and returns True if it contains duplicate v - medium
- Write a function called make_multiplier(n) that returns a lambda which multiplies its argument by n - medium
- Write a function called min_max that takes a list and returns a tuple of (minimum, maximum) using mi - medium
- Write a function called safe_average(numbers) that returns the average of a list - medium
- Write a function is_balanced(s) that uses a stack to check if parentheses are balanced - medium
- Write a function is_palindrome(s) using two pointers (left and right) that checks if a string reads - medium
- Write a function is_palindrome(s) using two pointers that checks if a string reads the same forwards - medium
- Write a function safe_max(numbers) that returns the largest number in a list, or None if the list is - medium
- Write a function that checks if two strings are anagrams using Counter - medium
- Write a function two_sum(nums, target) using a hash map - medium
- Write a function two_sum_sorted(nums, target) using two pointers on a sorted list - medium
- Write a generator function called 'evens' that yields even numbers from 2 to 10 (inclusive) - medium
- Write a generator function called 'powers_of_two' that yields 2**0, 2**1, 2**2, 2**3, and 2**4 in or - medium
- Write an if-elif-else chain to assign a letter grade based on `score`: "A" if score >= 90, "B" if sc - medium
- Write an if-else statement that prints "approved" if `balance` is greater than or equal to 100, othe - medium
- Write a recursive function factorial(n) that returns n - medium
- Write a recursive function sum_list(lst) that returns the sum of all elements - medium
- Write a simple decorator called shout that converts a function's string return value to uppercase - medium
- You have a list of weekly metrics - medium
- You have three fruit variables - medium
- You have two variables: a = 100 and b = 200 - medium
- Zip to Record - easy - Two lists become one record.