Practice Arena

Python Coding Challenges

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

467 challenges 330 easy 120 medium 17 hard
Python Basics easy

FizzBuzz, precisely

Return a newline-separated string for 1..n: Fizz, Buzz, FizzBuzz, or the number.

control flow strings modulo
2
+10 pts 12m
Python Basics easy

Even or odd?

Return 'even' or 'odd' for an integer.

modulo conditionals
1
+5 pts 5m
Python Basics easy

Sum of digits

Return the sum of all decimal digits of a non-negative integer.

arithmetic loops
2
+8 pts 10m
Python Basics easy

Power of two?

Return True if n is an exact power of 2.

bitwise math
+8 pts 8m
Python Basics easy

Prime checker

Return True if n is a prime number.

math loops
1
+10 pts 10m
Python Basics easy

Compound interest

Return the future balance after compound interest, rounded to two decimals.

math functions finance
+12 pts 12m
Python Basics easy

Clamp a Number to a Range

Implement a clamp function that returns a value within a specified range.

numbers conditionals comparisons
+5 pts 5m
Python Basics easy

Min of three numbers

Write a function that returns the minimum of three integers.

min comparison function
+5 pts 5m
Python Basics easy

Integer division and remainder

Write a function that performs integer division and returns both quotient and remainder.

operators division remainder
+8 pts 10m
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

Sign of a Number

Write a function that returns the sign of a number as a string.

conditionals numbers comparison
+5 pts 5m
Python Basics easy

Is a multiple of both

Write a function that returns True if a number is divisible by both of two given divisors.

modulo boolean function
+5 pts 5m
Python Basics easy

Digit count of an integer

Given an integer, return the number of digits it has, handling negatives and zero correctly.

integers loops arithmetic
+5 pts 5m
Python Basics easy

Boolean from comparison chain

Implement a function that evaluates a chain of comparisons and returns the boolean result.

comparison booleans evaluation
+8 pts 10m
Python Basics easy

Max of a variable-length list

Implement a function that returns the maximum value from a list of numbers without using max().

conditionals loops comparison
+10 pts 10m
Python Basics easy

Toggle a boolean n times

Apply boolean toggling n times and return the final boolean value.

booleans arithmetic modulo
+6 pts 8m
Python Basics easy

Between inclusive

Write a function that returns True if a number is between two given bounds, inclusive of the bounds.

comparison conditionals boundaries
+8 pts 10m
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

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

Set symmetric difference

Write a function that returns the elements found in exactly one of two sets, sorted ascending.

sets symmetric-difference sorting
+10 pts 15m
Python Basics easy

Swap Two Values

Implement a Python function that swaps two given values and returns them in swapped order.

variables assignment swap
+5 pts 5m
Python Basics easy

Hello, name!

Implement a function that returns a personalized greeting for a given name.

strings function formatting
+5 pts 5m
Python Basics easy

Leap Year Checker

Implement a function that returns True if a year is a leap year according to the Gregorian calendar rules.

conditionals boolean modulo
+10 pts 10m
Python Basics easy

Absolute Difference

Implement a function that returns the absolute difference between two numbers.

absolute value arithmetic function
+5 pts 5m
Python Basics easy

Max of three numbers

Implement a function that returns the maximum of three numbers using comparisons.

conditionals comparison numbers
+10 pts 10m
Python Basics easy

Sign of a number

Write a function sign_of_number that returns -1 for negatives, 0 for zero, and 1 for positives.

conditionals numbers comparison
+5 pts 5m
Python Basics easy

Countdown printer

Implement a function that prints a countdown from a given number down to 1, then returns 'Go!'.

loops conditionals function-definition
+5 pts 5m
Python Basics easy

Sum from 1 to n

Write a function that returns the sum of all integers from 1 to n (inclusive).

math arithmetic sum
+5 pts 5m
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

Find Minimum Value

Write a function that returns the minimum integer from a given list.

min list loop
+10 pts 10m
Python Basics easy

Range of values

Calculate the range (max minus min) of a list of numbers. Empty list returns 0.

min max numbers
+10 pts 10m
Python Basics easy

Is divisible by?

Create a function that returns True if a is divisible by b with no remainder, with a clear definition of edge cases.

division modulo conditionals
+10 pts 10m
Python Basics easy

Area of Rectangle

Write a function that returns the area of a rectangle given its width and height.

arithmetic function numbers
+5 pts 5m
Python Basics easy

Perimeter of triangle

Given three side lengths, return the perimeter (sum) of the triangle.

arithmetic geometry basics
+5 pts 5m
Python Basics easy

Volume of Cube

Write a Python function that returns the volume of a cube given its side length.

arithmetic return function
+5 pts 5m
Python Basics easy

Modulo Remainder

Implement a function that returns the remainder of a divided by b without using the modulo operator.

modulo arithmetic integers
+5 pts 5m
Python Basics easy

Print Pyramid Pattern

Implement a function that returns a centered asterisk pyramid as a list of strings.

loops strings pattern-printing
+10 pts 15m
Python Basics easy

Last Digit Extractor

Write a function that returns the last digit of a non-negative integer using the modulo operator.

integers modulo arithmetic
+5 pts 5m
Python Basics easy

Count word occurrences

Write a function that takes a sentence and returns a dictionary of word counts.

strings counting dictionaries
+10 pts 15m
Python Basics easy

Find Missing Number

Given a list of n distinct integers from 0..n with one missing, return the missing number.

math integers arrays
+10 pts 10m
Python Basics easy

Linear Search Implementation

Implement a linear search function that returns the index of the first occurrence of a target in a list, or -1 if not found.

linear-search list index
+10 pts 15m
Python Basics easy

Validate date format

Return True if input string is exactly YYYY-MM-DD and a real calendar date.

validation strings dates
+10 pts 10m
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

Showing 44 challenges · easy · 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.