Progress Milestones

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
L5
Asked in
Stitch Fix

Problem

Given a positive integer k, return a list of 10 milestone values at 10%, 20%, ..., 100% of k. Each value is int(k * pct / 100). Return the list of 10 integers in order.

Progress at every 10% increment. Keep the receipts.

Example 1

Input:

k = 100

Output:

[10,20,30,40,50,60,70,80,90,100]

Example 2

Input:

k = 35

Output:

[3,7,10,14,17,21,24,28,31,35]

Worked solution and explanation

Why this problem exists in real interviews

Milestone bucketing is the simplest possible test of whether you handle integer division correctly and whether you can express a percentage scan as a single comprehension. Interviewers use it as a five minute warmup before harder problems and watch for whether you reach for floats unnecessarily.


Break down the requirements

Step 1: Generate the percentage stops

You need 10, 20, ..., 100. range(10, 101, 10) gives exactly those ten values. Hard coding the literal list works too but the range form scales if the interviewer asks for 5 percent buckets.

Step 2: Use integer division to match the spec

The spec says int(k * pct / 100). Equivalently k * p // 100 in Python. Multiply before dividing so that small k values do not get truncated to 0 prematurely.

Step 3: Return as a list comprehension

A single list comp is the most idiomatic Python: [k * p // 100 for p in range(10, 101, 10)]. It reads as 'one milestone per percentage stop' which mirrors the spec sentence for sentence.


The solution

One line list comprehension
def progress_milestones(k):
    return [k * p // 100 for p in range(10, 101, 10)]

Common follow-up questions