Challenges

Python challenges

Classic Python: the challenge's words on the left, your code on the right, and Check runs its tests. No game: just Python, files and you.

A random challenge by level

Level 3: Loops, lists and functions: you plan it.

1

Python basics

Classic challenges: printing, input, numbers, if, loops, text, functions and files.

Levels 1–40 of 2 solved
  1. 1-8Average grade
  2. 1-10A prime number?
4

Conditions

Let the program choose: if, elif and else, comparing numbers, and joining conditions with and / or.

Levels 1–30 of 2 solved
  1. 4-8What triangle?
  2. 4-9How many solutions?
5

Loops

Do it again: for and range, while, adding up as you go, counting, and loops inside loops.

Levels 1–30 of 3 solved
  1. 5-7Digit by digit
  2. 5-8Fibonacci
  3. 5-9A multiplication square
6

Text

Work with words: letters by their place, slices, upper and lower case, counting, splitting and joining.

Levels 1–30 of 3 solved
  1. 6-7The longest word
  2. 6-8Digits in the text
  3. 6-9Caesar's cipher
7

Lists

Many values under one name: read a line of numbers, add them up, find the largest, pick some out, sort them.

Levels 2–30 of 3 solved
  1. 7-6Above the average
  2. 7-8The second largest
  3. 7-9Each once
8

Functions

Name a piece of code and use it again: def, parameters, return, and functions that use each other.

Levels 1–30 of 3 solved
  1. 8-6A greeting in four languages
  2. 8-7A digital root
  3. 8-8A palindrome sentence
9

Dictionaries and sets

Look things up by a name: dictionaries for counting and grouping, sets for what's different.

Levels 2–30 of 7 solved
  1. 9-3Word frequencies
  2. 9-4Letters in a word
  3. 9-5The most common word
  4. 9-6In both
  5. 9-7Points by name
  6. 9-8A word-by-word translator
  7. 9-9Anagrams
10

Files

Read data from a file and write answers to another: lines, numbers in rows, a count first, CSV.

Levels 2–30 of 5 solved
  1. 10-4The exam's shape
  2. 10-5A numbered copy
  3. 10-6The warmest day
  4. 10-7Long words
  5. 10-8A shopping bill
11

Algorithms

The classics, by hand: the smallest and largest, searching, sorting, binary search, primes, GCD and other bases.

Levels 3–40 of 6 solved
  1. 11-1The smallest and largest, by hand
  2. 11-2Searching one by one
  3. 11-3Bubble sort
  4. 11-4In its place
  5. 11-6Euclid's algorithm
  6. 11-8Into binary