- Cyber Success
- April 1, 2021
- IT Courses
How to Practice Python: 15 Exercises With Solutions and a Daily Plan
Practice Python Programming Language
Python practice means writing and running your own code to solve small problems, rather than only reading or watching a Python tutorial. Practice is what turns Python learning into skill: you build recall of syntax, data structures and logic, and you learn to debug errors on your own.
Python is the most popular programming language on the TIOBE Index (No. 1 at 17.76% in September 2026). Among people learning to code, 71.8% used Python in the Stack Overflow 2025 Developer Survey, up from 66.4% in 2024. That large learning community also means free practice platforms, exercises and project ideas are easy to find.
The most common beginner mistake is “tutorial hell”: watching lesson after lesson without writing original code. The fix is a short, daily routine. Each day, solve one exercise without help, check the solution, then extend the code with your own change.
This guide gives you 15 Python practice exercises for beginners, each with a tested solution and output. It also includes a 30-minute daily practice plan, the best free sites to practise Python, eight habits that make practice stick, and advice on moving from exercises to real projects.
Table of contents
- 8 Best Ways to Practice Python Programming for Beginners
- 15 Python Practice Exercises for Beginners (With Solutions)
- 30-Minute Daily Python Practice Plan
- Best Sites to Practice Python
- From Exercises to Projects
- Learn Python at Cyber Success
- Frequently Asked Questions
8 Best Ways to Practice Python Programming for Beginners
Editor note: this keeps the existing H2 (“8 Best Way” corrected to “8 Best Ways”) and its eight H3s, tightened. It replaces the two opening H2s, “How To Practice Python Programming Language for Beginners?” and “Practice Python Programming Language”.
The best way to practise Python is to write code every day, starting from firm basics and checking your work against documentation and other programmers. These eight habits make practice effective:
1. Get the basics solid first
Before solving problems, be comfortable with variables, data types, if statements, loops, functions, lists and dictionaries. Every exercise below uses only these. A free structured start is described in how to learn Python for free.
2. Write code yourself, every time
Type every example instead of copying it, then change one thing and predict the result before running it. Writing code from memory builds recall that reading cannot.
3. Join a Python community
Ask questions on Stack Overflow or the official Python Discourse forum, and read other people’s solutions on practice sites. Seeing three different solutions to one problem teaches more than solving it once.
4. Keep the practice loop on
Short daily practice beats long weekend sessions. Even 30 minutes a day keeps syntax fresh. See the daily plan below.
5. Stay current with Python
Use a current version: Python 3.15 was released on 9 October 2026, and 3.13 or 3.14 are fine for learning. Learn modern features such as f-strings and match-case from up-to-date sources, using these Python tips and tricks for beginners.
6. Read the documentation
When you use a new function, check it on docs.python.org or run help(function_name) in the Python shell. Reading the documentation is a skill interviewers and employers expect.
7. Take breaks when stuck
If you are stuck on an error for more than 20–30 minutes, step away and come back. Many bugs become obvious after a short break.
8. Get guidance when self-study stalls
If you keep losing momentum, a structured Python course in Pune adds deadlines, code reviews and a mentor to unblock you.
15 Python Practice Exercises for Beginners (With Solutions)
These 15 Python practice questions with solutions cover the skills beginners need first: conditions, strings, loops, functions, lists, dictionaries and error handling. They are grouped from easiest to hardest. Try each question for at least 10 minutes before reading the solution. Every solution was tested on Python 3.13, and the outputs shown are the real results.
Level 1: Basics and strings
- Even or odd. Write a program that prints whether a number is even or odd.
n = 7
print(“Even” if n % 2 == 0 else “Odd”) # Odd
- Sum of digits. Find the sum of the digits of 4721.
num = 4721
print(sum(int(d) for d in str(num))) # 14
- Reverse a string. Reverse the word “python”.
s = “python”
print(s[::-1]) # nohtyp
- Palindrome check. Check whether “Madam” reads the same backwards, ignoring case.
w = “Madam”
print(w.lower() == w.lower()[::-1]) # True
- Count vowels. Count the vowels in “Practice Python daily”.
text = “Practice Python daily”
print(sum(1 for ch in text.lower() if ch in “aeiou”)) # 6
Level 2: Loops and functions
- Factorial. Write a function that returns the factorial of n, using a loop.
def factorial(n):
result = 1
for i in range(2, n + 1):
result *= i
return result
print(factorial(5)) # 120
- Fibonacci series. Return the first n Fibonacci numbers.
def fibonacci(n):
a, b, seq = 0, 1, []
for _ in range(n):
seq.append(a)
a, b = b, a + b
return seq
print(fibonacci(8)) # [0, 1, 1, 2, 3, 5, 8, 13]
- Prime number check. Return True if a number is prime.
def is_prime(n):
if n < 2:
return False
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
return False
return True
print(is_prime(29), is_prime(21)) # True False
Checking divisors only up to the square root makes this much faster for large numbers. Interviewers often ask why.
- FizzBuzz. Print 1 to 15, but print “Fizz” for multiples of 3, “Buzz” for multiples of 5, and “FizzBuzz” for multiples of both.
for i in range(1, 16):
if i % 15 == 0: print(“FizzBuzz”, end=” “)
elif i % 3 == 0: print(“Fizz”, end=” “)
elif i % 5 == 0: print(“Buzz”, end=” “)
else: print(i, end=” “)
# 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz
- Grade calculator. Return a grade: A for 90 and above, B for 75 and above, C for 50 and above, otherwise Fail.
def grade(score):
if score >= 90: return “A”
elif score >= 75: return “B”
elif score >= 50: return “C”
else: return “Fail”
print([grade(s) for s in [95, 80, 55, 30]]) # [‘A’, ‘B’, ‘C’, ‘Fail’]
Level 3: Lists, dictionaries and errors
- Largest number without max(). Find the largest number in a list using a loop.
nums = [12, 45, 7, 89, 34]
largest = nums[0]
for x in nums:
if x > largest:
largest = x
print(largest) # 89
- Second largest number. Find the second largest distinct value in a list.
marks = [78, 92, 65, 92, 88]
unique = sorted(set(marks), reverse=True)
print(unique[1]) # 88
- Remove duplicates, keeping order.
items = [3, 1, 3, 2, 1, 4]
print(list(dict.fromkeys(items))) # [3, 1, 2, 4]
- Word frequency. Count how often each word appears in a sentence.
sentence = “the cat and the hat and the bat”
freq = {}
for word in sentence.split():
freq[word] = freq.get(word, 0) + 1
print(freq) # {‘the’: 3, ‘cat’: 1, ‘and’: 2, ‘hat’: 1, ‘bat’: 1}
- Anagram check. Check whether two words use the same letters.
def is_anagram(a, b):
return sorted(a.replace(” “, “”).lower()) == sorted(b.replace(” “, “”).lower())
print(is_anagram(“Listen”, “Silent”), is_anagram(“Hello”, “World”)) # True False
Bonus: safe number input. Convert text to a number without crashing on bad input.
def to_int(value):
try:
return int(value)
except ValueError:
return None
print(to_int(“42”), to_int(“abc”)) # 42 None
How to use these exercises: after solving each one, change it. Make the palindrome check ignore spaces, make FizzBuzz read the range from the user, or add input validation to the grade calculator. Extending your own solution is where most of the learning happens.
30-Minute Daily Python Practice Plan
To practise Python daily as a beginner, spend 30 minutes in four fixed blocks: review, solve, extend and log. Repeat the same routine every day, and rotate the topic through the week. A fixed routine removes the daily decision about what to study, which is where most self-learners lose momentum.
The daily 30 minutes
Minutes | Block | What to do |
0–5 | Review | Re-type yesterday’s solution from memory, without looking |
5–20 | Solve | Solve one new exercise without help: one from this page or one easy problem on a practice site |
20–27 | Extend | Change your solution: add input validation, handle an edge case, or rewrite it more simply |
27–30 | Log | Note the topic, any error you hit and how you fixed it, then commit the code to GitHub |
A weekly topic rotation
Day | Topic | Example from this page |
Monday | Strings | Reverse a string, palindrome, vowels |
Tuesday | Loops and conditions | FizzBuzz, prime check |
Wednesday | Functions | Factorial, Fibonacci, grade calculator |
Thursday | Lists | Largest, second largest, remove duplicates |
Friday | Dictionaries and sets | Word frequency, anagram |
Saturday | Mini project (45–60 minutes) | Extend the week’s code into a small program |
Sunday | Rest or review the week’s log | Redo the hardest exercise of the week |
Rules that keep the habit going
- Same time every day. Attach practice to an existing routine, such as right after college or before dinner.
- Never break the chain twice. Missing one day is normal, but missing two days in a row starts to break the habit.
- Count exercises solved, not hours watched. Five days of solved problems a week shows real progress.
Students balancing college or a job will find more scheduling tips in how to practise Python daily alongside college or a job.
Best Sites to Practice Python
The best free sites to practise Python are HackerRank, Exercism, Codewars, LeetCode, freeCodeCamp and Edabit. Each suits a different stage, from first syntax drills to interview preparation. A coding practice site gives you a problem, runs your code against hidden test cases, and tells you whether it passes.
Site | Best for | Level | Free access | Format |
HackerRank | Structured syntax drills and fresher screening tests | Beginner | Free | Topic-wise challenges with test cases |
Exercism (Python track) | Getting feedback on your code | Beginner to intermediate | Free, with optional volunteer mentoring | Exercises solved in the browser or locally |
Codewars | Daily habit-building | Beginner to advanced | Free | “Kata” puzzles ranked by difficulty, with community solutions |
Edabit | Short daily practice | Beginner | Free tier | Bite-sized challenges |
freeCodeCamp | A structured path with a certificate | Beginner to intermediate | Free | Interactive lessons, projects and an exam |
LeetCode | Data structures, algorithms and interviews | Intermediate | Free tier; Premium is paid | Timed problems and contests |
CodinGame | Practice through games | Beginner to intermediate | Free | Game-based puzzles |
StrataScratch | Python and SQL for data roles | Intermediate | Free tier | Real interview questions from companies |
Which site to use when
- Weeks 1–4: HackerRank’s Python track and Edabit, for syntax and basic logic
- Months 2–3: Exercism and Codewars, for feedback and varied problems
- Interview preparation: LeetCode easy and medium problems; StrataScratch if you are targeting data roles
For a detailed review of each platform and how to fit them around a course, read Best Free Resources to Practice Python Alongside Your Course.
From Exercises to Projects
Move from exercises to projects once you can solve most Level 2 and Level 3 exercises above without looking at the solution. For most beginners, that point comes after 3–4 weeks of daily practice. Exercises train individual skills, while projects train you to combine them, plan a program and fix bugs you did not expect. Recruiters review projects, not exercise counts.
How exercises grow into projects
Exercises you have solved | Project they lead to | New skill the project adds |
Grade calculator, safe input | Student report card generator | Reading and writing CSV files |
Word frequency, remove duplicates | Text analyser for any .txt file | File handling, collections.Counter |
FizzBuzz, even or odd (conditions) | Dice rolling simulator, Rock Paper Scissors | The random module, game loops |
Lists and dictionaries | Contact book or to-do list with save and load | JSON storage, menus, functions |
String checks | Password generator and strength checker | The string and secrets modules |
A simple project checklist
- Write down what the program should do in 3–5 sentences before coding.
- Build the smallest working version first, then add one feature at a time.
- Handle bad input with try/except and clear error messages.
- Put the code on GitHub with a short README that explains how to run it.
- Add one improvement a week later, such as a menu, file storage or a test.
For 10 beginner-friendly ideas with descriptions, see Python Mini Projects for Practice in 2026. When you are ready for something bigger, try this web scraping project in Python.
Learn Python at Cyber Success, Pune
The Python Full Stack course in Pune at Cyber Success turns daily practice into job-ready skills. It gives you:
- structured exercises
- trainer code reviews
- portfolio projects in Django and FastAPI
- SQL
- interview preparation
Placement assistance is available at the Deccan and Karve Nagar centres.
Call +91 9168665644 or email hello@cybersuccess.biz to book a free demo session.
Related reading
Frequently Asked Questions
Editor note: the two requested questions come first. The existing eight FAQs are kept but shortened and merged where they overlapped.
How can I practice Python daily as a beginner?
Spend 30 minutes a day in four blocks:
- 5 minutes re-typing yesterday’s solution from memory
- 15 minutes solving one new exercise without help
- 7 minutes extending your solution
- 3 minutes logging what you learned and committing it to GitHub
Rotate topics through the week, and build a small project at the weekend.
Where can I practice Python for free?
You can practise Python for free on:
- HackerRank
- Exercism
- Codewars
- Edabit
- freeCodeCamp
- CodinGame
- the free tiers of LeetCode and StrataScratch
The official tutorial at docs.python.org and the 15 exercises on this page are also free.
What is the best way for beginners to start practicing Python?
Learn the basics first (variables, conditions, loops, functions, lists and dictionaries), then solve one short exercise every day without copying. Check the solution, then change it.
How much time should a beginner spend practicing Python daily?
Thirty to sixty minutes of focused coding a day is enough to build steady progress. Consistency matters more than session length.
What are good Python practice questions for beginners?
Common beginner questions include even or odd, reverse a string, palindrome check, factorial, Fibonacci, prime check, FizzBuzz, second largest number, word frequency and anagram check. All of them are solved on this page.
Why is writing code important when learning Python?
Reading code builds recognition, but writing it builds recall and debugging skill. Interviews and jobs require you to write code from a blank screen.
Is reading Python documentation necessary for beginners?
Yes. Checking docs.python.org or running help() teaches you exactly what a function accepts and returns. It is also a habit employers expect.
When should I move from exercises to projects?
Move to projects once you can solve most beginner exercises without looking at solutions, usually after 3–4 weeks of daily practice. Start with small projects such as a contact book or a password generator.
Can a structured Python course help beginners learn faster?
Yes, especially for learners who lose momentum alone. A course adds a fixed plan, deadlines, code reviews and mentor support for when you are stuck.
