Free Python
Exercises to practice & level up.
Where can you practice Python for free? Right here. Pick a topic, download the PDF, solve it, tick it off. Stuck? Try the quick problems with hidden solutions. No signup, no paywall.
# Your daily Python workout def practice(topic): for n in range(1, 5): print(f"{topic}: exercise {n}") practice("Lists")
Variables
Create, assign and reuse values.
Strings
Slice, format and transform text.
Lists
Store, sort and loop over collections.
IfโฆElse
Make decisions with conditions.
Arrays
Work with ordered data and indexes.
While Loop
Repeat code while a condition holds.
Functions
Write reusable blocks of code.
Math
Numbers, operators and the math module.
Modules
Import and organise code.
Iterators
Understand iter() and next().
Lambda
Small anonymous functions.
Classes & Objects
Model real things with OOP.
General
Mixed problems across all topics.
Exercise 1 ยท Medium Level
Done with the basics? Combine everything in one tougher challenge.
Quick practice, with solutions.
Solve it in your editor first. Open the solution only to compare.
Reverse it
Ask for a word and print it backwards.
Show solution
word = input('Word: ')
print(word[::-1])Sum without sum()
Add up [4, 8, 15, 16, 23, 42] with a loop.
Show solution
total = 0
for n in [4, 8, 15, 16, 23, 42]:
total += n
print(total) # 108Countdown
Print 5 to 1 with a while loop, then ‘Go!’.
Show solution
n = 5
while n > 0:
print(n)
n -= 1
print('Go!')Even or odd
Write is_even(n) returning True or False.
Show solution
def is_even(n):
return n % 2 == 0
print(is_even(10)) # TrueWord counter
Count how often each word appears.
Show solution
text = 'to be or not to be'
counts = {}
for w in text.split():
counts[w] = counts.get(w, 0) + 1
print(counts)Frequently asked questions
Where can I practice Python exercises for free?
Right here. Every exercise is a free PDF covering variables, strings, lists, loops, functions, classes and more, plus five quick problems with solutions.
How can I teach myself Python for free?
Work through the topics in order, solve each exercise before looking at any solution, then try the Medium Level challenge.
Which exercises should a beginner start with?
Variables, strings and lists first, then ifโฆelse and while loops.
Are there Python exercises with solutions?
Yes. The Quick practice section has five problems on strings, lists, loops, functions and dictionaries, each with a solution that stays hidden until you click.
Do I need to install anything?
Only Python 3 and an editor such as IDLE, VS Code or PyCharm.
Does my progress save?
Ticks are stored in your own browser, so they stay on this device and are never sent anywhere.
Python done? Pick your next quest.
Same free, hands-on style in every language.
Learn Python properly
Tutorials and projects that turn these exercises into real programs.
open the course โ JSJavaScript exercises
Make the browser do things.
start now โ PHPPHP exercises
Power the webโs back end.
start now โ JavaJava projects
Objects, apps and Android.
start now โ </>Programming exercises
Logic and algorithms in any language.
start now โStuck on an exercise?
Ask the community.
Join our Telegram group for daily exercises, answers and friendly help.
