Explore the Python exercises on Exercism
Unlock more exercises as you progress. They’re great practice and fun to do!
Hello World
Tutorial Exercise
Exercism's classic introductory exercise. Just say "Hello, World!".
Guido's Gorgeous Lasagna
Learn the basics of Python by cooking Guido's Gorgeous Lasagna.
Ghost Gobble Arcade Game
Learn about bools by setting up the rules for the Ghost Gobble arcade game.
Currency Exchange
Learn about numbers by solving Chandler's currency exchange conundrums.
Meltdown Mitigation
Learn about conditionals and avoid a meltdown by developing a simple control system for a Nuclear Reactor.
Black Jack
Learn about comparisons by implementing some Black Jack judging rules.
Little Sister's Essay
Learn about string methods while improving your little sister's school essay.
Little Sister's Vocabulary
Learn about strings by helping your little sister with her vocabulary homework.
Card Games
Learn about lists by tracking hands in card games.
Chaitana's Colossal Coaster
Learn useful list methods helping Chaitana manage the lines for her colossal roller coaster.
Making the Grade
Learn about loops by grading and organizing your students exam scores.
Tisbury Treasure Hunt
Learn about tuples by helping out competitors in the Tisbury Treasure Hunt.
Inventory Management
Learn about dicts by managing warehouse inventory.
Mecha Munch Management
Learn about dictionary methods by building a shopping cart MVP for the Mecha Munch grocery app.
Locomotive Engineer
Learn about unpacking and multiple assignment in Python while helping Linus with his train control system.
Cater Waiter
Learn about sets by managing the menus and ingredients for your catering company's event.
Ellen's Alien Game
Learn about classes by creating an Alien for Ellen's game.
Plane Tickets
Learn about generators by assigning seats to passengers on Anaconda Airlines.
Leap
Easy
Determine whether a given year is a leap year.
Triangle
Easy
Determine if a triangle is equilateral, isosceles, or scalene.
Grains
Easy
Calculate the number of grains of wheat on a chessboard given that the number on each square doubles.
Armstrong Numbers
Easy
Determine if a number is an Armstrong number.
Collatz Conjecture
Easy
Calculate the number of steps to reach 1 using the Collatz conjecture.
Bob
Easy
Bob is a lackadaisical teenager. In conversation, his responses are very limited.
Raindrops
Easy
Convert a number into its corresponding raindrop sounds - Pling, Plang and Plong.
Darts
Easy
Calculate the points scored in a single toss of a Darts game.
Perfect Numbers
Easy
Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for positive integers.
Reverse String
Easy
Reverse a given string.
Pangram
Easy
Determine if a sentence is a pangram.
Isogram
Easy
Determine if a word or phrase is an isogram.
ISBN Verifier
Easy
Check if a given string is a valid ISBN-10 number.
Rotational Cipher
Easy
Create an implementation of the rotational cipher, also sometimes called the Caesar cipher.
RNA Transcription
Easy
Given a DNA strand, return its RNA Complement Transcription.
Resistor Color
Easy
Convert a resistor band's color to its numeric representation.
Resistor Color Duo
Easy
Convert color codes, as used on resistors, to a numeric value.
Resistor Color Trio
Easy
Convert color codes, as used on resistors, to a human-readable label.
Resistor Color Expert
Easy
Convert color codes as used on resistors with different bands to a human-readable label.
Secret Handshake
Easy
Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.
Anagram
Easy
Given a word and a list of possible anagrams, select the correct sublist.
House
Easy
Output the nursery rhyme 'This is the House that Jack Built'.
Binary Search
Easy
Implement a binary search algorithm.
Hamming
Easy
Calculate the Hamming distance between two DNA strands.
Flatten Array
Easy
Take a nested list and return a single list with all values except nil/null.
Difference of Squares
Easy
Find the difference between the square of the sum and the sum of the squares of the first N natural numbers.
List Ops
Easy
Implement basic list operations.
ETL
Easy
Change the data format for scoring a game to more easily add other languages.
Space Age
Easy
Given an age in seconds, calculate how old someone is in terms of a given planet's solar years.
Sum of Multiples
Easy
Given a number, find the sum of all the multiples of particular numbers up to but not including that number.
Gigasecond
Easy
Given a moment, determine the moment that would be after a gigasecond has passed.
Two Fer
Easy
Create a sentence of the form "One for X, one for me.".
Square Root
Easy
Given a natural radicand, return its square root.
Pig Latin
Easy
Implement a program that translates from English to Pig Latin.
Matching Brackets
Easy
Make sure the brackets and braces all match.
Sublist
Easy
Write a function to determine if a list is a sublist of another list.
Atbash Cipher
Easy
Create an implementation of the Atbash cipher, an ancient encryption system created in the Middle East.
Diamond
Easy
Given a letter, print a diamond starting with 'A' with the supplied letter at the widest point.
Protein Translation
Easy
Translate RNA sequences into proteins.
Prime Factors
Easy
Compute the prime factors of a given natural number.
Say
Easy
Given a number from 0 to 999,999,999,999, spell out that number in English.
Acronym
Easy
Convert a long phrase to its acronym.
Series
Easy
Given a string of digits, output all the contiguous substrings of length `n` in that string.
Run-Length Encoding
Easy
Implement run-length encoding and decoding.
Nth Prime
Easy
Given a number n, determine what the nth prime is.
Twelve Days
Easy
Output the lyrics to 'The Twelve Days of Christmas'.
Roman Numerals
Easy
Convert modern Arabic numbers into Roman numerals.
Word Count
Easy
Given a phrase, count the occurrences of each word in that phrase.
Scrabble Score
Easy
Given a word, compute the Scrabble score for that word.
Proverb
Easy
For want of a horseshoe nail, a kingdom was lost, or so the saying goes. Output the full text of this proverbial rhyme.
Luhn
Easy
Given a number determine whether or not it is valid per the Luhn formula.
D&D Character
Easy
Randomly generate Dungeons & Dragons characters.
Robot Name
Easy
Manage robot factory settings.
Phone Number
Easy
Clean up user-entered phone numbers so that they can be sent SMS messages.
Queen Attack
Easy
Given the position of two queens on a chess board, indicate whether or not they are positioned so that they can attack each other.
Transpose
Easy
Take input text and output it transposed.
Yacht
Easy
Score a single throw of dice in the game Yacht.
Eliud's Eggs
Easy
Help Eliud count the number of eggs in her chicken coop by counting the number of 1 bits in a binary representation.
Saddle Points
Easy
Detect saddle points in a matrix.
OCR Numbers
Easy
Given a 3 x 4 grid of pipes, underscores, and spaces, determine which number is represented, or whether it is garbled.
Robot Simulator
Easy
Write a robot simulator.
Grade School
Easy
Given students' names along with the grade that they are in, create a roster for the school.
Sieve
Easy
Use the Sieve of Eratosthenes to find all the primes from 2 up to a given number.
Pythagorean Triplet
Easy
Given an integer N, find all Pythagorean triplets for which a + b + c = N.
Circular Buffer
Easy
A data structure that uses a single, fixed-size buffer as if it were connected end-to-end.
Matrix
Easy
Given a string representing a matrix of numbers, return the rows and columns of that matrix.
High Scores
Easy
Manage a player's High Score list.
Kindergarten Garden
Easy
Given a diagram, determine which plants each child in the kindergarten class is responsible for.
Bottle Song
Easy
Produce the lyrics to the popular children's repetitive song: Ten Green Bottles.
Allergies
Easy
Given a person's allergy score, determine whether or not they're allergic to a given item, and their full list of allergies.
Simple Cipher
Easy
Implement a simple shift cipher like Caesar and a more secure substitution cipher.
Poker
Easy
Pick the best hand(s) from a list of poker hands.
Wordy
Easy
Parse and evaluate simple math word problems returning the answer as an integer.
Crypto Square
Easy
Implement the classic method for composing secret messages called a square code.
Clock
Easy
Implement a clock that handles times without dates.
Rectangles
Easy
Count the rectangles in an ASCII diagram.
Simple Linked List
Easy
Write a simple linked list implementation that uses Elements and a List.
Tree Building
Easy
Refactor a tree building algorithm.
Connect
Easy
Compute the result for a game of Hex / Polygon.
All Your Base
Medium
Convert a number, represented as a sequence of digits in one base, to any other base.
Minesweeper
Medium
Add the numbers to a minesweeper board.
Spiral Matrix
Medium
Given the size, return a square matrix of numbers in spiral order.
Variable Length Quantity
Medium
Implement variable length quantity encoding and decoding.
Change
Medium
Correctly determine change to be given using the least number of coins.
Killer Sudoku Helper
Medium
Write a tool that makes it easier to solve Killer Sudokus
Rail Fence Cipher
Medium
Implement encoding and decoding for the rail fence cipher.
Palindrome Products
Medium
Detect palindrome products in a given range.
Tournament
Medium
Tally the results of a small football competition.
Food Chain
Medium
Generate the lyrics of the song 'I Know an Old Lady Who Swallowed a Fly'.
Scale Generator
Medium
Generate musical scales, given a starting note and a set of intervals.
Largest Series Product
Medium
Given a string of digits, calculate the largest product for a contiguous substring of digits of length n.
Markdown
Medium
Refactor a Markdown parser.
Meetup
Medium
Calculate the date of meetups.
Pascal's Triangle
Medium
Compute Pascal's triangle up to a given number of rows.
Grep
Medium
Search a file for lines matching a regular expression pattern. Return the line number and contents of each matching line.
Linked List
Medium
Implement a doubly linked list.
Complex Numbers
Medium
Implement complex numbers.
Ledger
Medium
Refactor a ledger printer.
Hangman
Medium
Implement the logic of the hangman game using functional reactive programming.
Go Counting
Medium
Count the scored points on a Go board.
Forth
Medium
Implement an evaluator for a very simple subset of Forth.
Binary Search Tree
Medium
Insert and search for numbers in a binary tree.
Rational Numbers
Medium
Implement rational numbers.
Bowling
Medium
Score a bowling game.
Knapsack
Medium
Given a knapsack that can only carry a certain weight, determine which items to put in the knapsack in order to maximize their combined value.
DOT DSL
Medium
Write a Domain Specific Language similar to the Graphviz dot language.
Custom Set
Medium
Create a custom set type.
Zebra Puzzle
Medium
Solve the zebra puzzle.
Affine Cipher
Medium
Create an implementation of the Affine cipher, an ancient encryption algorithm from the Middle East.
Word Search
Medium
Create a program to solve a word search puzzle.
Alphametics
Medium
Given an alphametics puzzle, find the correct solution.
Bank Account
Medium
Simulate a bank account supporting opening/closing, withdraws, and deposits of money. Watch out for concurrent transactions!
React
Medium
Implement a basic reactive system.
Zipper
Medium
Creating a zipper for a binary tree.
Two Bucket
Medium
Given two buckets of different size, demonstrate how to measure an exact number of liters.
Dominoes
Medium
Make a chain of dominoes.
Satellite
Medium
Rebuild binary trees from pre-order and in-order traversals.
Book Store
Medium
To try and encourage more sales of different books from a popular 5 book series, a bookshop has decided to offer discounts of multiple-book purchases.
SGF Parsing
Medium
Parsing a Smart Game Format string.
PaaS I/O
Medium
Report network IO statistics.
REST API
Hard
Implement a RESTful API for tracking IOUs.
POV
Hard
Reparent a graph on a selected node.