13 topics ยท 51 free PDF exercises

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.

my_practice.py
# Your daily Python workout
def practice(topic):
    for n in range(1, 5):
        print(f"{topic}: exercise {n}")

practice("Lists")
0 / 51 done
๐Ÿ”€
Beginner

Ifโ€ฆElse

Make decisions with conditions.

Exercise 1PDF โ†“
Exercise 2PDF โ†“
Exercise 3PDF โ†“
Exercise 4coming soon
No topic matches. Try โ€œlistsโ€ or โ€œloopsโ€.
Level up

Exercise 1 ยท Medium Level

Done with the basics? Combine everything in one tougher challenge.

Download My Exercise โ†“

Quick practice, with solutions.

Solve it in your editor first. Open the solution only to compare.

Strings

Reverse it

Ask for a word and print it backwards.

Show solution
word = input('Word: ')
print(word[::-1])
Lists

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)  # 108
Loops

Countdown

Print 5 to 1 with a while loop, then ‘Go!’.

Show solution
n = 5
while n > 0:
    print(n)
    n -= 1
print('Go!')
Functions

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))  # True
Dictionaries

Word 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.

Scroll to Top