PYnative

Python Programming

  • Learn Python
    • Python Tutorials
    • Python Basics
    • Python Interview Q&As
  • Exercises
    • Python Exercises
    • C Programming Exercises
    • C++ Exercises
  • Quizzes
  • Code Editor
    • Online Python Code Editor
    • Online C Compiler
    • Online C++ Compiler
Home » Python Exercises

Practice Python Exercises & Challenges with Solutions [800+ Coding Questions]

Free Coding Exercises for Python Developers. Practice Python with 29 topic-wise exercises with over 800+ coding questions covering everything from Python basics to advanced.

What is included in these Python Exercises?

  • All exercises are tested on Python 3.
  • Each exercise contains 20-40 coding questions or challenges, focusing on specific Python topics to give you targeted practice
  • Reference articles are provided for help.
  • Hints and solutions are provided for every question. This enables you to immediately check your code and learn from any mistakes
  • Practice each Exercise in the Online Python Code Editor

Whether you're a beginner taking your first steps or an experienced developer looking to refine your skills, these exercises are designed to be beneficial.

Also, See:

  • Learn Python to solve these exercises.
  • Python Quizzes: 14 Different Python quizzes
  • Python Interview Questions and Answers

Below is the list of exercises. Select the exercise you want to solve. All the Best.

Basic Exercises for Beginners

Total Exercises: 40

This Python beginner's exercise helps you quickly learn and practice basic skills by solving coding questions and challenges on below topics.

Topics: Python Basics, Variables, Operators, Loops, String, Numbers, List

Python Loop Exercises

Total Exercises: 40

This exercise contains coding challenges to solve using if-else conditions, for loops, the range() function, and while loops.

Topics: Control flow statements, Loop, and while loop

Intermediate Python Exercises

Total Exercises: 65

Intermediate Python coding exercises primarily focuses on loops, strings, list, dictionary, sets, decorators, Generators (yield), OOP, and multi-threading, List/Dict comprehensions, and Lambda functions, File Handling, regular expression, Date and Time, other miscellaneous topics.

Python Input and Output Exercises

Total Exercises: 23

Solve coding questions on input and output operations in Python. Also, we practice file handling.

Topics: Python I/O, File I/O

Python Functions Exercises

Total Exercises: 18

Practice how to create a function, nested functions, and use the function arguments effectively in Python by solving different questions.

Topics: Function arguments, built-in functions.

Python String Exercises

Total Exercises: 38

Solve Python string coding questions to learn and practice string operations and manipulations.

Python List Exercises

Total Exercises: 45

This exercise contains coding questions to learn and practice list operations, manipulations, functions, and list comprehension.

Topic: Python List

Python Dictionary Exercises

Total Exercises: 40

This exercise contains coding questions to help Python developers to learn and practice dictionary operations and manipulation.

Topic: Python Dictionary

Python Set Exercises

Total Exercises: 31

Practice and solve various set operations, manipulations, and set functions.

Topic: Python Sets

Python Tuple Exercises

Total Exercises: 32

Practice and solve various tuple operations, manipulations, and tuple functions.

Topic: Python Tuples

Python Data Structure Exercises

Total Exercises: 10

Practice coding questions on widely used Python types such as List, Set, Dictionary, and Tuple.

Python Comprehensions Exercises

Total Exercises: 25

Comprehensions exercises including list, dict, set, generator comprehensions exercises, from beginner to expert level to helping you write more efficient and Pythonic code.

Python Collections Module Exercises

Total Exercises: 25

Practice coding questions on Python's collections module, including Counter, defaultdict, OrderedDict, deque, and namedtuple to work with specialized data structures.

Topics: Counter, defaultdict, OrderedDict, deque, namedtuple

Python Date and Time Exercises

Total Exercises: 30

This exercise aims to help Python developers to learn and practice DateTime and timestamp coding problems.

Topics: Date and Time, time, Date, Calendar.

Python OOP Exercises

Total Exercises: 31

This Python Object-oriented programming (OOP) exercise aims to help Python developers to learn and practice OOP concepts.

Topics: OOP, Object, Classes, Inheritance

Python Exception Handling Exercises

Total Exercises: 20

This exercise contains coding questions to gain proficiency in file operations such as reading, writing, renaming a file, copying file, deleting a file, managing file properties, content filtering, and replacement.

Topics: Exception Handling

Python Math and Statistics Exercises

Total Exercises: 30

Practice Python's built-in math and statistics modules through coding problems covering square roots, powers, trigonometry, logarithms, mean, median, mode, and statistical analysis.

Topics: math module, statistics module

Python File Handling Exercises

Total Exercises: 34

Exercises contains coding questions to gain proficiency in file operations such as reading, writing, renaming a file, copying file, deleting a file, managing file properties, content filtering, and replacement.

Topics: File Handling

Python OS and Sys Module Exercises

Total Exercises: 30

Practice working with Python's os and sys modules to interact with the operating system, manage files and directories, handle environment variables, and control script execution.

Topics: os module, sys module, file system operations, environment variables

Python RegEx Exercises

Total Exercises: 30

This Regex exercise set helps you build hands-on experience with pattern matching through 30 exercises, progressing from basic matching to advanced text extraction and manipulation.

Topics: Regex

Python Lambda & Functional Programming Exercises

Total Exercises: 20

Practice Python lambda expressions and functional programming techniques through exercises covering map(), filter(), reduce(), and functools, from beginner to advanced level.

Topics: Lambda functions, map(), filter(), reduce(), functools

Python Iterators & Generators Exercises

Total Exercises: 30

From beginner to expert level, covering topics from the yield keyword to advanced coroutines and itertools.

Topics: Iterators & Generators

Python Itertools & Functools Exercises

Total Exercises: 20

Practice advanced iteration and functional tools in Python through exercises on itertools.permutations(), combinations(), chain(), groupby(), and functools utilities.

Topics: itertools, functools, combinatorics, lazy evaluation

Random Data Generation Exercises

Total Exercises: 10

Practice and solve coding questions to learn the various techniques to generate random data in Python.

Topics: random module, secrets module, UUID module

Python NumPy Exercises

Total Exercises: 50

Practice NumPy coding questions such as Array manipulations, numeric ranges, Slicing, indexing, Searching, Sorting, and splitting, and more.

Python Pandas Exercises

Total Exercises: 10

Practice Data Analysis using Python Pandas. Practice Data-frame, Data selection, group-by, Series, sorting, searching, and statistics.

Python Matplotlib Exercises

Total Exercises: 10

Practice Data visualization using Python Matplotlib. Line plot, Style properties, multi-line plot, scatter plot, bar chart, histogram, Pie chart, Subplot, stack plot.

Python Database Exercises

Total Exercises: 5

Solve database coding problems to master database operations step by step.

Use any of the MySQL, PostgreSQL, SQLite to solve the exercise

Python JSON Exercises

Total Exercises: 9

Practice and Learn JSON creation, manipulation, Encoding, Decoding, and parsing using Python

Topics: JSON

Python OS and Sys Module Exercises: 30 Coding Problems with Solutions

Updated on: June 13, 2026 | Leave a Comment

Filed Under: Python, Python Exercises

Python Collections Module Exercises: 25 Coding Problems on Counter, defaultdict, OrderedDict, deque, namedtuple

Updated on: June 13, 2026 | Leave a Comment

Filed Under: Python, Python Exercises

Python Math and Statistics Exercises: 30 Coding Problems with Solutions

Updated on: June 13, 2026 | Leave a Comment

Filed Under: Python, Python Exercises

Python Itertools and Functools Exercises: 20 Coding Problems with Solutions

Updated on: June 13, 2026 | Leave a Comment

Filed Under: Python, Python Exercises

Python Exception Handling Exercises: 20 Coding Problems with Solutions

Updated on: June 13, 2026 | Leave a Comment

Filed Under: Python, Python Exercises

Python Lambda & Functional Programming Exercises with Solutions

Updated on: June 13, 2026 | Leave a Comment

Filed Under: Python, Python Exercises

Python Comprehensions Exercises: list, dict, set, generator comprehensions exercises

Updated on: June 13, 2026 | Leave a Comment

Filed Under: Python, Python Exercises

Python Regex Exercises: 30 Coding Problems with Solutions

Updated on: June 13, 2026 | Leave a Comment

Filed Under: Python, Python Exercises, Python RegEx

Python Iterators and Generators Exercises: 30 Coding Problems with Solutions

Updated on: June 13, 2026 | Leave a Comment

Filed Under: Python, Python Exercises

Intermediate Python Exercises: 65 Coding Problems with Solutions

Updated on: January 7, 2026 | 7 Comments

Filed Under: Python, Python Exercises

Python File Handling Exercises: 30+ Coding Problems with Solutions

Updated on: June 13, 2026 | 1 Comment

Filed Under: Python, Python Exercises, Python File Handling

30+ Python Object-Oriented Programming (OOP) Exercise: Classes and Objects Exercises

Updated on: June 13, 2026 | 56 Comments

Filed Under: Python, Python Exercises, Python Object-Oriented Programming (OOP)

Python Date and Time Exercises: 30 Coding Problems with Solutions

Updated on: June 13, 2026 | 10 Comments

Filed Under: Python, Python Exercises

Python Dictionary Exercises: 40 Coding Problems with Solutions

Updated on: June 13, 2026 | 67 Comments

Filed Under: Python, Python Basics, Python Exercises

Python Tuple Exercises: 30 Coding Problems with Solutions

Updated on: June 13, 2026 | 101 Comments

Filed Under: Python, Python Basics, Python Exercises

Python Set Exercises: 30 Coding Problems with Solutions

Updated on: June 13, 2026 | 30 Comments

Filed Under: Python, Python Basics, Python Exercises

Python Loops Exercises: 40+ Coding Problems with Solutions

Updated on: June 13, 2026 | 327 Comments

Filed Under: Python, Python Basics, Python Exercises

Python Functions Exercises: 18 Coding Problems with Solutions

Updated on: June 13, 2026 | 163 Comments

Filed Under: Python, Python Basics, Python Exercises

Python Input and Output Exercise: 20+ Coding Problems with Solutions

Updated on: June 13, 2026 | 111 Comments

Filed Under: Python, Python Basics, Python Exercises

Python list Exercises: 45 Coding Problems with Solutions

Updated on: June 13, 2026 | 210 Comments

Filed Under: Python, Python Basics, Python Exercises

Python JSON Exercise

Updated on: June 13, 2026 | 10 Comments

Filed Under: Python, Python Exercises, Python JSON

Python Data Structure Exercise for Beginners

Updated on: June 13, 2026 | 120 Comments

Filed Under: Python, Python Basics, Python Exercises

Python String Exercises: 35+ Coding Problems with Solutions

Updated on: June 13, 2026 | 235 Comments

Filed Under: Python, Python Basics, Python Exercises

Python Matplotlib Exercise

Updated on: March 9, 2021 | 25 Comments

Filed Under: Python, Python Exercises

Python Pandas Exercise

Updated on: June 13, 2026 | 56 Comments

Filed Under: Pandas, Python, Python Exercises

Python NumPy Exercise: 50 Practice Questions With Solutions (Beginner to Advanced)

Updated on: June 13, 2026 | 32 Comments

Filed Under: Python, Python Exercises

Python Basic Exercise for Beginners: 40 Coding Problems with Solutions

Updated on: February 8, 2026 | 531 Comments

Filed Under: Python, Python Basics, Python Exercises

Useful Python Tips and Tricks Every Programmer Should Know

Updated on: May 17, 2021 | 23 Comments

Filed Under: Python, Python Exercises

Python Random Data Generation Exercise

Updated on: June 5, 2025 | 13 Comments

Filed Under: Python, Python Exercises, Python Random

Python Database Programming Exercise

Updated on: June 13, 2026 | 17 Comments

Filed Under: Python, Python Databases, Python Exercises

Online Python Code Editor

Updated on: November 25, 2025 |

Filed Under: Python, Python Exercises

About PYnative

PYnative.com is for Python lovers. Here, You can get Tutorials, Exercises, and Quizzes to practice and improve your Python skills.

Follow Us

To get New Python Tutorials, Exercises, and Quizzes

  • Twitter
  • Facebook
  • Sitemap

Explore Python

  • Learn Python
  • Python Basics
  • Python Databases
  • Python Exercises
  • Python Quizzes
  • Online Python Code Editor
  • Python Tricks

Coding Exercises

  • C Exercises
  • C++ Exercises
  • Python Exercises

Legal Stuff

  • About Us
  • Contact Us

We use cookies to improve your experience. While using PYnative, you agree to have read and accepted our:

  • Terms Of Use
  • Privacy Policy
  • Cookie Policy

Copyright © 2018–2026 pynative.com