Practice Arena

Python Coding Challenges

Write real Python in the browser. Instant feedback. From beginner to expert.

925 challenges 556 easy 323 medium 46 hard
Python Basics easy

Count down from n

Implement a function that returns a list from n down to 1.

loops range lists
+5 pts 5m
Python Basics easy

Multiplication Table Row

Return the nth row of a multiplication table as a list of 1..n products.

loops lists multiplication
+5 pts 5m
Python Basics easy

Last Occurrence of a Value

Implement a function that returns the last index of a given value in a list, or -1 if it's not present.

lists search indexing
+10 pts 15m
Python Basics easy

Cycle a List Once

Implement a function that rotates a list right by one position.

lists rotation indexing
+5 pts 5m
Python Basics easy

Boolean Mask Filter

Write a function that filters a list based on a boolean mask and returns the selected elements.

filter boolean lists
+10 pts 15m
Python Basics easy

Replace negatives with zero

Implement a function that replaces all negative numbers in a list with zero.

lists loops conditionals
+10 pts 10m
Python Basics easy

Average of a list

Write a function that computes the average of a list of numbers, handling empty lists by returning 0.

average list statistics
+5 pts 5m
Python Basics easy

Map, Filter, Reduce

Implement three functions using map, filter, and reduce to manipulate a list of integers.

map filter reduce
+10 pts 15m
Python Basics easy

Count Leading Zeros

Write a function that returns the number of leading zeros in a list of integers.

lists iteration counting
+8 pts 8m
Python Basics easy

Remove Duplicates from Sorted Array

Given a sorted list, remove duplicates in-place and return the new length.

lists in-place two-pointers
+10 pts 15m
Python Basics easy

Filter by Age

Filter a list of person dictionaries by age and return their names.

loops conditionals dictionaries
+8 pts 12m
Python Basics easy

Insert New Row

Implement a function that inserts a new row into a 2D list at a specified index.

lists insert rows
+5 pts 5m
Python Basics easy

Rank Employees by Salary

Sort a list of employee dictionaries by salary descending, tie-break by name, and return ranked strings.

sorting dictionaries lists
+8 pts 10m
Python Basics easy

Broadcast Add Scalar

Add a scalar to every number in a 2D list and return a new 2D list without modifying the original.

nested-loops addition lists
+10 pts 15m
Python Basics easy

Fancy Index Select

Given a 2D matrix and a list of row indices, select those rows in order and return them as a new 2D list.

indexing lists matrix
+10 pts 10m
Python Basics easy

Reshape array dimensions

Implement a function that reshapes a 1D list into a 2D list with given dimensions.

reshape matrix lists
+8 pts 10m
Python Basics easy

Cumulative Sum Vectorized

Implement a function that returns the cumulative sum of a list of numbers.

lists cumulative sum
+10 pts 10m
Python Basics easy

Element-wise Clip

Implement a function that clips each element of a list to a specified range.

clipping lists conditionals
+8 pts 10m
Python Basics easy

Percentile Calculation

Given a list of numbers and a target value, return the percentile rank of that value in the list.

lists statistics math
+8 pts 10m
Python Basics easy

Euclidean Distance Matrix

Write a function to compute the Euclidean distance between every pair of points from two lists.

math lists loops
+10 pts 15m
Python Basics easy

Order by Name

Implement a function that sorts a list of names alphabetically ignoring case, returning a new list.

sorting strings lists
+10 pts 10m
Python Basics easy

Argmax along axis

Write a function that returns index positions of the maximum values along rows or columns of a 2D list.

lists max index
+10 pts 10m

Showing 1–22 of 22 challenges · Python Basics

Python Basics — Python coding challenges

What you will find here

This page lists python basics challenges — real Python problems you solve in the browser IDE with instant test feedback. Each challenge includes a clear brief, starter code, and automated checks.

Challenges vs tutorials and quizzes

Challenges test what you can build under constraints. For guided teaching, use our Python tutorials. For quick checks, try quizzes or copy snippets from code samples.