Assessment

Python Assessment Test

Python assessment test for hiring: what it covers, sample coding questions by level, a scoring rubric, red flags, and how long a Python test should take.

30-45 minutes·5 question types·3 difficulty levels·
Python Assessment Test

The short answer

A python assessment test for hiring typically runs 30-45 minutes, short coding problems, debugging exercises, code reading and output prediction, code completion and scenario-based questions, at 3 difficulty levels. Give it after the first screen and before interviews, and score it on the areas below, fixed before you see any answers, so every candidate is judged the same way.

  • Core Python syntax, data types and control flow
  • Data structures (lists, dictionaries, sets, tuples) and when to use each
  • Functions, classes and object-oriented design
  • Error handling and exception management
For hiring teams

Cohesyve tests Python inside an AI job simulation of the role, after finding and contacting candidates. Ten candidates free, no card.

About to take a Python test? Practise it free →

A Python assessment test, often called a Python coding test, checks whether a candidate can read, write and debug working Python 3 code for the job: core syntax and data structures, functions and classes, error handling, the standard library, and libraries such as pandas where the role needs them. For a screening stage, 30 to 45 minutes with two or three short problems and one debugging task tells you more than a long list of trivia questions. Python is used for backend services, data analysis, automation, testing and machine learning, so the best tests set problems from the role you are hiring for and score the code against a rubric agreed in advance.

Format

Short coding problemsDebugging exercisesCode reading and output predictionCode completionScenario-based questions

What it measures

  • Core Python syntax, data types and control flow
  • Data structures (lists, dictionaries, sets, tuples) and when to use each
  • Functions, classes and object-oriented design
  • Error handling and exception management
  • File I/O, string handling and working with large inputs
  • Comprehensions, generators, decorators and context managers
  • Working with common libraries (pandas, NumPy, requests) where the role needs them
  • Readable, Pythonic code and basic testing
For hiring teams

Test Python on the real work

Cohesyve builds an AI job simulation from your job description that covers Python as the role uses it, finds and contacts candidates, and returns a ranked shortlist. Ten candidates free, no card.

Who takes it

Software Engineer candidates (backend, full-stack)Data Analyst and Data Scientist candidatesDevOps and automation engineer candidatesMachine Learning Engineer candidatesQA Automation Engineer candidates

Topics covered

Core Python

  • Variable scoping
  • String formatting
  • Control flow
  • Built-in functions
  • Data type conversions

Data Structures

  • List vs. tuple vs. set
  • Dictionary operations
  • The collections module
  • Sorting with key functions
  • Time complexity of lookups

OOP and design

  • Class design
  • Dataclasses
  • Magic methods
  • Composition vs. inheritance
  • Separating I/O from logic

Advanced Topics

  • Decorators
  • Generators and iterators
  • Context managers
  • Async/await
  • Testing with pytest

Sample questions

What does this print, and why? def add(item, bucket=[]): bucket.append(item); return bucket. Then print(add(1)) and print(add(2)).

Beginner

Look for Second call prints [1, 2]. Explains that the default list is created once, when the function is defined, and fixes it with bucket=None and a new list inside the function.

Given a list of orders as dictionaries with customer and amount keys, return total spend per customer, highest first.

Beginner

Look for A dictionary (or defaultdict/Counter) accumulation in one pass, sorted with a key function; handles an empty list; clear names; no nested loops over the whole list.

This script reads a 2 GB log file with readlines() and keeps the lines containing ERROR. It runs out of memory in production. Fix it.

Intermediate

Look for Iterates over the file object line by line inside a with block (or uses a generator), explains that readlines() loads the whole file into memory, and keeps the output streaming too.

Write a retry helper that calls a flaky API up to three times with a short wait between attempts, then re-raises the last error. How would other functions reuse it?

Intermediate

Look for A decorator or wrapper; catches specific exceptions, not a bare except; re-raises with the original traceback; mentions backoff; makes the wait injectable so it can be tested.

A pandas DataFrame of transactions has duplicate rows and a date column stored as text. Produce revenue by month.

Intermediate

Look for Decides which columns define a duplicate before dropping, converts dates with pd.to_datetime and handles bad values, groups by month, and checks the totals against the raw data.

A test that depends on datetime.now() passes locally but fails in CI around midnight. How do you make it reliable?

Advanced

Look for Identifies time and timezone as the hidden input, passes the clock or the current time in as a parameter (or freezes time in tests), and uses timezone-aware datetimes.

Review this 40-line function that parses a CSV upload, validates rows and writes to the database in one loop. What would you change before merging?

Advanced

Look for Separates parsing, validation and persistence; collects validation errors instead of failing on the first; uses a transaction; adds tests; prioritises the changes rather than listing style nits.

Red flags

  • Uses a bare except that swallows every error
  • Cannot explain why their own code works when asked a follow-up
  • Nested loops where a dictionary or set lookup is the obvious tool
  • Does not spot mutable default arguments or shared state when shown them
  • Never considers empty input, None or duplicates
  • Reads whole large files into memory by default

Scoring rubric

CriterionWeightWhat strong looks like
Correctness30%Works on the given cases and on the edge cases the candidate raised.
Python fluency20%Uses the right data structures, built-ins and standard library instead of reinventing them.
Debugging and reasoning20%Finds the root cause and explains it plainly.
Readability and design15%Clear names, small functions, I/O separated from logic.
Testing and edge cases15%Writes or describes tests that would catch a real regression.

Why it is used

For employers

  • See real Python skill before the interview stage
  • Spend engineer interview time only on candidates who can write working code
  • Compare candidates on the same problems and the same rubric
  • Each candidate gets a different variant, so answers cannot be passed around
  • Use the submitted code as the starting point for the technical interview

For candidates

  • Demonstrate real Python skills beyond what a resume shows
  • Show what you can do in one timed sitting, without a multi-day take-home project
  • Problems tailored to the role rather than abstract puzzles
  • Stand out based on ability rather than credentials alone

Common questions

What is a Python coding test?

A Python coding test is a timed exercise in which a candidate writes, reads or fixes Python code to solve problems set by the employer. It is used to check practical programming skill before interviews, and it is scored on whether the code works, how it handles edge cases, and how readable it is.

How long is a Python assessment?

For screening, 30 to 45 minutes is enough for two or three short problems and one debugging task. Later-stage take-homes run longer, but keep them scoped to a few hours at most, because long unpaid projects put off strong candidates who already have jobs.

What questions are asked in a Python assessment test?

Typically data-structure problems (counting, grouping, de-duplicating), debugging a broken function, predicting output, handling files or API responses, and for data roles a pandas task. Senior candidates also get design and code review questions like the samples above.

What Python version does the assessment cover?

Python 3, using features available in currently supported releases. Questions test practical, real-world skills rather than version-specific trivia.

Should candidates be allowed to use documentation or AI tools?

Decide based on the job. If engineers on the team use documentation and AI assistants every day, allowing them in the test measures the work more accurately; in that case, weight the follow-up explanation and the debugging task more heavily.

How do I pass a Python assessment test?

Practise short problems with dictionaries, sets and sorting; get comfortable reading a stack trace; handle empty and invalid input; and explain your reasoning in comments or notes. Clear, correct code beats clever code.

For hiring teams

Test Python before the first interview

Cohesyve takes your job description, finds candidates, reaches out to them and tests Python in an AI job simulation of the real work, then returns a ranked shortlist.

1,500+

assessments completed

50%

faster time-to-hire

5 min

from JD to assessment

No credit card · 10 free candidates · Plans sized to your hiring volume

For job seekers

About to take a Python test yourself? Practise on an AI job simulation that uses it. 3 free tests, no card.

Practise a Python test free →

See Cohesyve in action

Free 30-min walkthrough

See it on your role