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
Error Handling & Exceptions medium

Suppress Specific Exceptions

Implement a custom context manager that suppresses specified exception types within its block.

context-manager exceptions suppress
+20 pts 20m
Regular Expressions medium

Validate Email Regex

Implement a function that validates email addresses using regex with specific rules.

regex email validation
+20 pts 25m
Regular Expressions easy

Validate phone number

Write a function that uses regular expressions to determine if a given string is a valid US phone number.

regex validation phone
+10 pts 15m
Regular Expressions easy

Match IPv4 Address

Write a function that uses a regular expression to check if a string is a valid IPv4 address.

regex validation ipv4
+8 pts 12m
Regular Expressions hard

Match IPv6 Address

Write a function that uses a regex to validate whether a string is a fully expanded IPv6 address.

regex validation ipv6
+25 pts 30m
Regular Expressions medium

Match Credit Card Pattern

Write a function that validates a credit card number string against a set of formatting rules.

regex validation credit-card
+25 pts 25m
Regular Expressions easy

Validate Hex Color Code

Write a function that validates hex color codes using regular expressions.

regex validation strings
+10 pts 10m
Regular Expressions easy

Multiline anchor match

Extract lines beginning with a plain-text prefix from multiline strings using Python's re module.

regex anchors multiline
+10 pts 15m
Regular Expressions easy

Lookahead Validation

Write a regex-based function to check if a password meets length and character class requirements.

regex lookahead validation
+8 pts 10m
Regular Expressions easy

Match Balanced Parentheses with Regex

Write a function that uses regular expressions to determine if parentheses are balanced and properly nested.

regex strings validation
+10 pts 15m
Regular Expressions easy

Match scientific notation

Implement a function that checks if a string is in valid scientific notation.

regex validation scientific-notation
+10 pts 15m
Regular Expressions easy

Non-greedy quantifier

Implement a function that uses a non-greedy regex to extract the shortest substring between two delimiters.

regex lazy quantifier string parsing
+8 pts 10m
Regular Expressions easy

Named group extraction

Parse a log line into structured fields using named groups and re.match.

regex named-groups parsing
+8 pts 12m
Math & Number Theory easy

Nth Triangular Number

Implement a function that returns the nth triangular number efficiently.

math formula integers
1
+10 pts 10m
Math & Number Theory easy

Clamp and round to nearest ten

Clamp a number between given bounds and round the result to the nearest ten with halves away from zero.

clamping rounding math
+10 pts 12m
Math & Number Theory easy

Integer Square Root Floor

Implement a function that returns the greatest integer whose square is ≤ n, using only integer operations.

math binary-search integer
+8 pts 12m
Math & Number Theory easy

Power set size

Compute the size of the power set of a given sequence.

math subsets counting
+8 pts 10m
Math & Number Theory easy

Polynomial evaluator

Implement a polynomial evaluator that computes the value of a polynomial given as a list of coefficients.

polynomial math evaluation
+5 pts 10m
Math & Number Theory easy

Catalan number

Implement a function that returns the nth Catalan number using dynamic programming.

math dynamic-programming combinatorics
+10 pts 15m
Math & Number Theory easy

Stirling number

Implement a function to compute Stirling numbers of the second kind S(n,k).

stirling-numbers dynamic-programming combinatorics
+10 pts 15m
Math & Number Theory easy

Euler Totient Function

Implement Euler's totient function φ(n) for positive integers.

math number-theory totient
+10 pts 15m
Math & Number Theory easy

Sieve of Eratosthenes

Implement the Sieve of Eratosthenes to return a sorted list of all primes up to a given integer n.

primes sieve loops
+10 pts 15m
Math & Number Theory easy

Prime Factorization

Return a sorted list of prime factors of a positive integer, including repeated factors.

prime math loops
+10 pts 15m
Math & Number Theory easy

Count divisors

Compute the number of positive divisors of a given integer using its prime factorization.

divisors prime factorization math
+10 pts 15m

Showing 481–504 of 925 challenges

Guide: free Python coding challenges

Practice Python by solving problems

PythonSkillset challenges are hands-on coding exercises from beginner to advanced. Open a challenge, read the problem, write Python in the split-pane editor, and run tests with Pyodide — no install required.

How to use the arena

  1. Pick a category — basics, algorithms, strings, and more
  2. Open a challenge, read the statement, and edit the starter code
  3. Run tests, fix failures, then try a related quiz or tutorial lesson

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.