Python interview questions for data analysts
Implement small Python functions for analyst interview problems. Read the function signature and input/output examples, then open the exercise to run Python in a free browser workspace with hidden tests. Some questions ask you to repair a colleague’s function.
10 questions · Easy to hard · Python in your browser
Easy Python questions
- Find the bugs in a median functionEasy · Code review
- Two sum in a sorted arrayEasy · Two pointers
- Valid palindromeEasy · Two pointers
- Range sum queriesEasy · Prefix sums
- Merge two sorted linked listsEasy · Linked list
Medium Python questions
- Merge overlapping intervalsMedium · Intervals
- Longest subarray with at most k distinct valuesMedium · Sliding window
- Run-length encodingMedium · Arrays and strings
- Top k frequent elementsMedium · Hash maps
Hard Python questions
How to practice for your interview
- Start with an easy question. Restate the inputs and output, then work through the example by hand.
- Move to medium questions for intervals, hash maps and moving windows. Describe a simple solution before improving its time or space cost.
- Try the remaining questions and functions to fix. Explain the invariant your loop or search maintains, then test its boundaries.
Check more than the sample
Test empty input when allowed, a single element, repeated values and an answer at either end. Passing the example is a start; the workspace also checks unseen cases.