Reported October 2026
Hartford Financial Services

Assign Student Grades from CSV Marks

Reported by candidates from Hartford Financial Services's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Hartford Financial Services OA. Under 2s to a working solution.
Founder's read

The Hartford Financial Services OA reported in October 2026 looks like a CSV problem, but it isn't. It's a single column transformation: take marks, map them to a letter grade, keep everything else untouched. The format is tagged SQL, though the prompt talks about a dataframe. Either way the job is a CASE-style bucket on one integer column. No joins, no grouping, no aggregation. If you're taking this in the next day or two, the risk isn't difficulty, it's overthinking. StealthCoder sits invisibly on your screen as a safety net if you blank on the syntax mid-assessment.

The problem

You receive student marks from a comma-separated CSV with header student_id,marks. Each record has one unique student ID and one integer mark.
The practice runner has already parsed that CSV into the students dataframe using the displayed schema. Implement assign_grades(students) to assign a letter grade to every row. CSV loading is context for this exercise; the judged operation is the column transformation on the supplied dataframe.
Use these grade bands:
MarkGrade
90..100A
80..89B
70..79C
60..69D
0..59F
Return a dataframe with columns student_id, marks, and grade in that order. Retain every original ID and mark and preserve the CSV row order. Equal marks still belong to separate students. Do not average marks, sort or group students, or round marks.
A header-only CSV is valid and returns an empty dataframe with the same three result columns.

Tables
students: student_id PK (Integer), marks (Integer)

Constraints
The CSV has header student_id,marks and from 0 through 1000 data rows.
Student IDs are unique integers from 1 through 10^9.
Every mark is an integer from 0 through 100; neither field is null.
Each record already contains the single mark used for its grade; no subject aggregation or rounding is required.

Reported by candidates. Source: FastPrep

Pattern and pitfall

What it really reduces to: a conditional mapping over each row. In SQL that's SELECT student_id, marks, CASE WHEN marks >= 90 THEN 'A' WHEN marks >= 80 THEN 'B' WHEN marks >= 70 THEN 'C' WHEN marks >= 60 THEN 'D' ELSE 'F' END AS grade FROM students. Order the WHEN branches from highest to lowest so each threshold only needs one comparison. In a dataframe, the equivalent is a vectorized bucket, not a row loop. The pitfalls are all things the prompt tells you not to do: don't sort, don't group, don't average, don't round. Keep the original row order and the exact column order student_id, marks, grade. A header-only input must still return the three columns with zero rows, so avoid code that infers columns from data. If you freeze on the exact syntax, StealthCoder can hand you the clean version live, but this one is short enough to write from memory.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Assign Student Grades from CSV Marks cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Hartford Financial Services's OA.

Hartford Financial Services reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Assign Student Grades from CSV Marks FAQ

How hard is the Hartford Financial Services grade assignment question really?+

Easy. It's one conditional mapping on a single integer column. There's no join, no aggregation, and no window function. The only way to miss is by ignoring the instructions, like sorting the output or changing the column order. Read the constraints twice and you're fine.

What's the trick to getting the grade bands right?+

Order the checks from highest to lowest and use only the lower bound. If marks >= 90 it's A, else if >= 80 it's B, and so on, with F as the fallback. That avoids off-by-one mistakes from writing both ends of every range like 80..89.

Do I need to sort or group the students?+

No. The prompt says to preserve the CSV row order and explicitly forbids sorting or grouping. Equal marks are separate students, so don't deduplicate either. Just add the grade column and return the rows as they came in.

What happens with an empty input?+

A header-only CSV is valid and should return an empty result with the columns student_id, marks, and grade. In SQL a CASE expression over zero rows naturally gives that. In a dataframe, make sure the grade column is still created, not skipped.

How do I prepare for this in 48 hours?+

Practice writing a CASE WHEN bucket and its dataframe equivalent, like numpy select or a mapped function, until you can type them without looking. Then check output column order and row order on a small sample. That covers nearly everything this question tests.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Hartford Financial Services.

OA at Hartford Financial Services?
Invisible during screen share
Get it