The Data Foundry
Built by Data with Pranjal
All Practice
Choose a guided lab or practice track
SQL Lab
Interview SQL with real data and validation
Python Lab
Data engineering Python practice
PySpark Lab
Spark code review and production fixes
Airflow Lab
DAG incidents, retries, sensors, and backfills
AWS Lab
Service choices, architecture, security, and cost
System Design Studio
Architecture trade-offs and interview framing
The Data Foundry is improving every week. If something feels unclear, broken, or missing, tell us and we will use it to improve the platform.
Inspect the data, write the solution, run validation checks, and explain the production lesson.
Labs
75
Attempted
0
Completed
Free
20
Choose a question first
Open any Python question from the library. Once you choose one, the question navigator stays on the left so moving to the next lab is quick.
Implement the function for this coding task: Reverse a string.
Implement the function for this coding task: Check whether a string is a palindrome.
Implement the function for this coding task: Find the first non-repeating character.
Implement the function for this coding task: Check whether two strings are anagrams.
Implement the function for this coding task: Find the most frequent character.
Implement the function for this coding task: Longest common prefix.
Implement the function for this coding task: Compress a string with counts.
Implement the function for this coding task: Validate parentheses.
Implement the function for this coding task: Count vowels and consonants.
Implement the function for this coding task: Word frequency from a sentence.
Implement the function for this coding task: Remove duplicates while preserving order.
Implement the function for this coding task: Find the missing number from 1 to n.
Implement the function for this coding task: Two Sum.
Implement the function for this coding task: Rotate a list by k steps.
Implement the function for this coding task: Move all zeros to the end.
Implement the function for this coding task: Merge two sorted lists.
Implement the function for this coding task: Find the intersection of two lists.
Implement the function for this coding task: Top K frequent elements.
Implement the function for this coding task: Group records by key.
Implement the function for this coding task: Flatten a nested list.
Implement the function for this coding task: Count occurrences using a dictionary.
Implement the function for this coding task: Invert a dictionary with duplicate values.
Implement the function for this coding task: Merge a list of dictionaries by id.
Implement the function for this coding task: Detect duplicates in a list.
Implement the function for this coding task: Sort a dictionary by value.
Implement the function for this coding task: Count pairs with a given sum.
Implement the function for this coding task: Find symmetric pairs.
Implement the function for this coding task: Build running balance from transactions.
Implement the function for this coding task: Factorial.
Implement the function for this coding task: Fibonacci number.
Implement the function for this coding task: Prime number check.
Implement the function for this coding task: Generate all primes up to n.
Implement the function for this coding task: Binary search in a sorted array.
Implement the function for this coding task: Longest substring without repeating characters.
Implement the function for this coding task: Merge overlapping intervals.
Implement the function for this coding task: Maximum subarray sum.
Implement the function for this coding task: Read a large log file and count ERROR lines.
Implement the function for this coding task: Parse CSV and aggregate a numeric column.
Implement the function for this coding task: Parse nested JSON and extract selected fields.
Implement the function for this coding task: Compare two files line by line.
Implement the function for this coding task: Find duplicate records in a CSV by key.
Implement the function for this coding task: Compute a rolling 7-day average.
Implement the function for this coding task: Convert a list of tuples into a nested dictionary.
Implement the function for this coding task: Implement a simple log parser.
Implement the function for this coding task: Write a decorator that measures execution time.
Implement the function for this coding task: Create a generator that yields chunks from an iterable.
Implement the function for this coding task: Implement a simple LRU cache.
Implement the function for this coding task: Find common elements across multiple lists.
Implement the function for this coding task: Normalize an email list.
Implement the function for this coding task: Find the top customer by revenue from transactions.
Normalize raw payment status strings into success, failed, pending, and unknown buckets, then return the count for every bucket.
Read log lines and return unique job IDs from lines containing FAILED or ERROR. Job IDs may appear as job_id=... or job=....
Given event dictionaries, keep the first valid occurrence of every event_id and preserve arrival order.
For each record, identify required fields whose value is None or an empty string.
Aggregate quantities by sku. Inbound movements add stock; outbound movement types out, sale, and ship subtract stock.
Extract unique dates from paths containing dt=YYYY-MM-DD or date=YYYY-MM-DD.
Mask each valid email as first_letter***@domain. Invalid or missing emails should return None.
Count success-like statuses and return success percentage rounded to two decimals.
Return the latest update for each customer_id using updated_at and sequence as a deterministic tie-breaker.
Compare source keys and warehouse keys and return missing, extra, and matched keys.
Group events into user sessions. A new session starts when the gap from the previous event is greater than gap_minutes.
Given expected and completed timestamps, return job IDs that are late by more than sla_minutes or still incomplete.
Group attempts by dag_id and task_id, count failed attempts, keep max attempt number, and report the final status from the highest attempt.
Filter successful financial events, add sales, subtract refunds, and aggregate by event_date.
Compare expected business dates with dates extracted from available partition paths.
Project each record to the expected field list, fill missing fields with None, and ignore extras.
Group files within each partition into deterministic compaction batches whose total size is at most target_mb when possible.
Aggregate revenue by customer_id and return all customers whose revenue is at least the Nth customer's revenue.
For each key, keep the latest event by sequence. DELETE events should remove the key from current state.
Return a valid dependency order. When multiple tasks are ready, choose alphabetical order. If there is a cycle, return ["CYCLE_DETECTED"].
For each event, calculate the error rate over the trailing window_size events including the current event.
For each event_id, keep the record with the highest batch_id and then highest offset.
Compare incoming rows with current dimension rows. Changed existing customers should be expired and reinserted; new customers should only be inserted.
Calculate percentage change per metric and return metrics where absolute change is greater than threshold_pct.
Split a date range into contiguous windows of at most max_days, skipping blackout_dates.