The Progress Parade
An easy Python interview practice problem on DataDriven. Write the Python and run it against test cases, with instant feedback.
- Domain
- Python
- Difficulty
- easy
- Seniority
- L3
- Asked in
- Stitch Fix
Problem
Given a positive integer k, return the list [k*10//100, k*20//100, ..., k*100//100], i.e. each 10% milestone of k floored to an integer using integer (floor) division. The result is ALWAYS a list of exactly 10 integers, one for each milestone from 10% through 100%. For example, k=10 returns [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] and k=5 returns [0, 1, 1, 2, 2, 3, 3, 4, 4, 5].
Just tell them how far along you are.
Example 1
Input:
k = 10
Output:
[1,2,3,4,5,6,7,8,9,10]
Example 2
Input:
k = 5
Output:
[0,1,1,2,2,3,3,4,4,5]
Worked solution and explanation
Why this problem exists in real interviews
This tests arithmetic milestone computation, a simple but practical problem. It checks whether candidates can translate 'every 10%' into a concrete list of integer values derived from a total count, using floor division to keep every milestone a clean integer.
Break down the requirements
Step 1: Enumerate the 10% milestones
Walk the ten milestone percentages 10, 20, ..., 100. These are the points at which you report progress.
Step 2: Compute k*p//100 for each milestone
For each percentage p, the milestone value is k*p//100 using floor (integer) division, so every entry is an integer rather than a fraction.
Step 3: Always return ten elements
The output is ALWAYS exactly 10 integers, even when k is small. For k < 10 the early milestones floor down to 0 (e.g. k=5 starts [0, 1, 1, ...]); they are still emitted, not skipped.
The solution
def print_progress(k: int) -> list:
result = []
for p in range(10, 101, 10):
result.append(k * p // 100)
return resultCommon follow-up questions
- What if the interval were configurable (e.g., every 5%)? (Tests parameterizing the step count.)
- What if you needed the percentage labels rather than the item counts? (Tests returning the raw percentages instead of counts.)
- What if k could be zero? (Tests handling the edge case where no work exists.)