Python Practice: 93 Unique Online Coding Exercises
Whether you're just starting your learning journey or looking to brush up before a job interview, getting the right kind of Python practice can make a big difference.
Research shows that hands-on practice is the most effective way to learn,* and luckily there are so many different ways to practice that you're bound to find one that works best for you.
In this post, we'll share 93 ways to practice Python online by writing actual code, broken down into different practice methods.
Table of Contents
- Exercises
- Core Python Programming (Great for Beginners)
- Intermediate Python Programming
- Data Handling and Manipulation with NumPy
- Data Handling and Manipulation with pandas
- Data Analysis
- Complexity and Algorithms
- Courses
- Python Introduction (Great for Beginners)
- Data Analysis and Visualization
- Data Cleaning
- Machine Learning
- AI and Deep Learning
- Probability and Statistics
- Projects
- Tutorials
- Frequently Asked Questions
- Where can I practice Python programming?
- How can I practice Python programming?
- Can I learn Python in 30 days?
- Can I practice Python on mobile?
- How quickly can I learn Python?
- AI is advancing so quickly - should I still learn Python?
- Basic Mathematical Operators (free) — Use Python to perform calculations and printing results to the screen.
- Variables and data types (free) — Work with variables and doing calculations with variables.
- Lists and loops (free) — Practice using Python lists and for loops.
- Dictionaries 1 (free) — Use dictionaries in Python.
- Dictionaries 2 (free) — More practice with dictionaries and frequency tables.
- Lists (free) — Practice using lists in Python.
- Conditional statements (if-else) — Use conditional statements in Python.
- Sets — Practice using sets in Python.
- Python functions — Define and call functions.
- Intermediate Python functions — Practice more advanced usage of functions like returning multiple values.
- Object oriented programming (OOP) — Define classes, methods, and attributes.
- NumPy index selection (free) — Select values from ndarrays.
- NumPy creating ndarrays — Create ndarrays with specific values and shapes.
- NumPy ndarray methods — Use ndarray methods to perform calculations.
- NumPy broadcasting — Work with ndarrays with different shapes and using broadcasting to create ndarrays.
- NumPy boolean masks — Select data from ndarrays use boolean masks
- NumPy datatypes — Work with NumPy datatypes
- NumPy sorting — Practice sorting ndarrays
- NumPy stacking and splitting — Stack and split ndarrays
- Pandas series (free) — Use and build pandas series.
- Creating and manipulating dataframes — Create and manipulate pandas dataframes.
- Selecting data with Pandas — Select data from dataframes.
- Loading and exploring data — Load data into dataframes and explore it.
- Pandas boolean masks — Use boolean masks to select data from dataframes.
- Pandas Data Cleaning — Clean data in a dataframe.
- Cleaning and preparing data (free) — Write functions to remove incorrect characters and fill missing values.
- Data analysis basics — Manipulate data from CSV files using Python dictionaries and functions.
- Working with dates and times — Practice with the
datetime
module in Python. - Time complexity of algorithms (free) — Identify the type of time complexity of Python functions.
- Constant time complexity — Find the constant time complexity of functions.
- Logarithmic complexity — Practice finding the logarithmic time complexity of functions.
- Sorting algorithms — Create and work with sorting algorithms in Python.
- Space complexity — Practice space complexity by writing Python functions.
- Introduction to Python — Write code using Python syntax; work with different types of data; and perform basic Python operations such as working with variables, processing numerical and text data, and manipulating lists.
- Basic Operators and Data Structures in Python — Learn the fundamentals of Python for loops, dictionaries, and conditional logic (if-else).
- Python Functions and Jupyter Notebook — Write Python functions, build functions that employ multiple return statements and return multiple variables, and install and use Jupyter Notebook.
- Python for Data Science: Intermediate — Manipulate text, clean messy data, work with object-oriented programming concepts, and use dates and times in Python.
- Pandas and NumPy Fundamentals — Use NumPy and pandas for data exploration, preparation, and analysis.
- Data Visualization Fundamentals — Balance graph creation and statistics in your visualizations using tools such as Matplotlib and Seaborn.
- Storytelling Data Visualization and Information Design — Use information design and data visualization to tell compelling stories.
- Data Cleaning and Analysis — Manipulate, combine, transform, and merge data; manipulate strings; and work with missing values in Python.
- Data Cleaning in Python: Advanced — Clean and manipulate text data using basic and advanced regular expressions, how to resolve missing data, and how to employ lambda functions and list comprehension with pandas.
- Data Cleaning Project Walkthrough — Combine multiple datasets and prepare them for analysis.
- Intro to Supervised Machine Learning — Build a supervised machine learning model in Python, and train and improve it for better performance and accuracy.
- Intro to Unsupervised Machine Learning — Learn about unsupervised machine learning models in Python, when to apply them, and what differentiates them from supervised machine learning models.
- Linear Regression Modeling — Build, evaluate, and interpret the results of a linear regression model, as well as using linear regression models for inference and prediction.
- Gradient Descent Modeling — Learn the fundamentals of gradient descent and how to implement this algorithm in Python.
- Logistic Regression Modeling — Build and evaluate logistic regression models, both from scratch and using scikit-learn.
- Decision Tree and Random Forest Modeling — Learn the foundations of Decision Trees including identifying the key components of trees, interpreting them, classifying new observations using decision trees and calculating optimal thresholds for both classification and regression trees.
- Optimizing Machine Learning Models — Explore the most common methods and techniques that will enable you to optimize your machine learning models for better efficiency.
- APIs for AI Applications — Use Python for retrieving, analyzing, and manipulating real-world data from various sources including the World Development Indicators database.
- Prompting Large Language Models (LLMs) — Create an AI-powered chatbot using Python, that incorporates key concepts like prompt engineering, managing conversation histories, and efficiently regulating token usage within an AI framework.
- Intro to Deep Learning in Tensorflow — Learn the fundamentals of deep learning, as well as how to build, train, and evaluate models using the TensorFlow framework.
- Introduction to Statistics in Python — Work with techniques for sampling data, concepts such as discrete variables and random variables, and the different types of charts and graphs you might use to visualize frequency distributions.
- Intermediate Statistics in Python — Summarize distributions using mean, median, and mode. You’ll also learn to measure variability using variance or standard deviation and how to locate and compare values using z-scores.
- Introduction to Probability in Python — Estimate probabilities, work with the addition and multiplication rules, and define permutations and combinations.
- Introduction to Conditional Probability in Python — Assign probabilities to events based on certain conditions, evaluate whether they are in a relationship of statistical independence or not, and on prior knowledge by using Bayes’s theorem.
- Hypothesis Testing in Python — Learn advanced statistical concepts like significance testing and multi-category chi-square testing,
- Profitable App Profiles for the App Store and Google Play Markets (free) — Assume the role of a data analyst at a company that builds apps for Android and iOS. Since the company’s revenue depends on in-app ads, your task is analyzing historical data from app markets to determine which apps attract the most users.
- Learn and Install Jupyter Notebook (free) — Run Python code in a Jupyter Notebook and learn how to install Jupyter locally.
- Build a Word Guessing Game (free) — Have some fun, and create a functional and interactive word-guessing game using Python.
- Build a Garden Simulator Text Based Game (free) — Create an interactive text-based “Garden Simulator” using object-oriented programming, error handling, and randomness.
- Build a Food Ordering App — Create a functional and interactive food ordering application using Python.
- Investigating Fandango Movie Ratings (free) — Step into the role of a data journalist to analyze movie ratings data and determine if there’s evidence of bias in Fandango’s rating system.
- Exploring Hacker News Posts (free) — Analyze a dataset from Hacker News and apply your Python skills in string handling, object-oriented programming, and data management to uncover trends in user submissions.
- Exploring eBay Car Sales Data — Use Python to work with a scraped dataset of used cars from eBay Kleinanzeigen, a classifieds section of the German eBay website.
- Finding Heavy Traffic Indicators on I-94 — Explore how using the pandas plotting functionality along with the Jupyter Notebook interface allows us to explore data quickly using visualizations.
- Storytelling Data Visualization on Exchange Rates — Quickly create multiple subsetted plots using one or more conditions.
- Clean and Analyze Employee Exit Surveys — Work with exit surveys from employees of the Department of Education in Queensland, Australia. Play the role of a data analyst and pretend the stakeholders want answers to important data questions.
- Analyzing NYC High School Data — Discover the SAT performance of different demographics using scatter plots and maps.
- Building Fast Queries on a CSV (free) — Act as a Python developer to build an inventory system for a laptop store. You’ll apply efficient data structures and algorithms to enable fast queries.
- Analyzing Wikipedia Pages (free) — Process over 54 MB of Wikipedia articles to find specific text matches. Using Python and MapReduce, you’ll build a parallel solution to search the dataset and return match details efficiently.
- Building a database for crime reports — Use PostgreSQL to build a database with proper schemas, tables, and user roles to store and manage crime report data efficiently.
- Predicting Heart Disease (free) — Act as a data scientist at a healthcare solutions company to build a model that predicts a patient’s risk of developing heart disease based on their medical data.
- Predicting Insurance Costs — Use linear regession modeling to predict insurance costs.
- Developing a Dynamic AI Chatbot — Create an AI chatbot that can take on different personas and keep track of conversation history.
- Python strings — See how to declare the string data type, the relationship between the string data type and the ASCII table, the properties of the string data type, and some important string methods and operations.
- Python dictionaries — Learn how to create a Python dictionary, how to use its methods, and dictionary comprehension.
- Python data structures — Read about what data structures exist in Python, when to apply them, and their pros and cons.
- Python classes — Learn how to create and work with Python classes. See what Python classes are, why we use them, what types of classes exist, how to define a class in Python and declare/adjust class objects,
- Python lists — Read how to define, create, and slice lists, as well as how to add/remove items and use a for loop to iterate over a list.
- If statements — Use conditional logic with if, elif, and else to streamline your code's efficiency.
- Python datetime — Learn the uses of the
datetime
module, extract dates, and work with timestamps. - Python ternary — Understand what a Python ternary operator is and when it's useful.
- Python subprocess — See how to use the
subprocess
module in Python to run different subprocesses during the course of a regular python script. - Python math module — Read about the common constants and functions implemented in the
math
module — and how to use them. - Read files in Python — Learn how to open files, use the
with
context manager, read text, CSV, and JSON files, and understand different file modes. - Lambda functions — Define lambda functions in Python and explore the advantages and limitations of employing them.
- Reset index in pandas — Discusses the
reset_index()
pandas method, why we may need to reset the index of a DataFrame in pandas, and how we can apply and tune this method. - GroupBy in pandas — Explore how to create a GroupBy object in pandas library of Python and how this object works.
- Getting Started with APIs — Understand how to retrieve data for AI and data science projects using APIs (Application Programming Interfaces).
- Introduction to Keras — Learn how to install and start using Keras; the Sequential API; and the steps for building, compiling, and training a model..
- Implement Support Vector Machines (SVMs) — Read about support vector machines, one of the most popular classification algorithms. Learn how to implement SVMs for a classification task in Python.
-
Dataquest.io has dozens of free interactive practice questions, as well as free interactive lessons, project ideas and walkthroughs, tutorials, and more.
-
HackerRank is a great site for practice that’s also interactive.
-
CodingGame is a fun platform for practice that supports Python.
-
Edabit has Python challenges that can be good for practicing or self-testing.
-
Install Python on your machine. You can download it directly here, or download a program like Anaconda Individual Edition that makes the process easier. Or you can find an interactive online platform like Dataquest and write code in your browser without installing anything.
-
Find a good Python project or some practice problems to work on.
-
Make detailed plans. Scheduling your practice sessions will make you more likely to follow through.
-
Join an online community. It's always great to get help from a real person. Reddit has great Python communities, and Dataquest's community is great if you're learning Python data skills.
Practice with Free Python Coding Exercises
Exercises are a great way to practice a specific topic with targeted efficiency. For example, do you have an upcoming job interview where you know you'll be asked about Python dictionaries? Completing exercises about dictionaries will help refresh your skills and ensure you can confidently speak to this Pythonic datatype.
Core Python Programming (Great for Beginners)
Intermediate Python Programming
Data Handling and Manipulation with NumPy
Data Handling and Manipulation with pandas
Data Analysis
Complexity and Algorithms
Explore our full library of Python practice problems to continue improving your skills.
Practice with Online Python Courses
If you're looking for more structure, then practicing with Python courses online may resonate with you. Courses guide you through a topic, so if you want to gain a new skill or you're rusty on an old one, completing a course is an excellent way to go.
Throughout these courses, you'll be given questions and assignments to test your skills. Additionally, some of these courses contain a guided project that allows you to apply everything you've learned.
See below for some recommended courses.
Python Introduction (Great for Beginners)
Data Analysis and Visualization
Data Cleaning
Machine Learning
AI and Deep Learning
Probability and Statistics
These courses are a great way to practice Python online, and they're all free to start. If you're looking for more courses, you can find them on Dataquest's course page.
Practice with Python Projects
One of the most effective ways to practice Python online is with projects. When I was learning Python, it was easy to forget newly acquired skills. When I discovered that I could do projects to practice my newfound knowledge, it helped me remember new syntax. Additionally, I built a great portfolio of work to show potential employers.
Here are a few projects you can use to start practicing right now.
Beginner Projects
Data Analysis Projects
Data Engineering Projects
Machine Learning and AI Projects
If these didn't spark your interest, here are plenty of other online Python projects you can try.
Practice with Online Python Tutorials
If online practice exercises, courses, and projects don't appeal to you, here are a few blog-style tutorials to help you learn Python. I like to use this type of resource when I'm on my phone to get some productive reading done, even when I can't code on my computer!
Core Python Concepts (Great for Beginners)
Intermediate Techniques
Data Analysis and Data Science
The web is also full of thousands of other beginner Python tutorials. As long as you've got a solid foundation in the Python basics, you can find great practice through many of them.
Frequently Asked Questions
Where can I practice Python programming?
You can also practice Python using all of the interactive lessons listed above
How can I practice Python at home?
Can I learn Python in 30 days?
In 30 days, you can definitely learn enough Python to be able to build some cool things. You won't be able to master Python that quickly, but you could learn to complete a specific project or do things like automate some aspects of your job.
Read more about how long it takes to learn Python.
Can I practice Python on mobile?
Yes, there are many apps that allow you to practice Python on both iOS and Android. However, this shouldn't be your primary form of practice if you aspire to use Python in your career— it's good to practice installing and working with Python on desktops and laptops since that's how most professional programming work is done.
How quickly can I learn Python?
You can learn the fundamentals of Python in a weekend. If you're diligent, you can learn enough to complete small projects and genuinely impact your work within a month or so. Mastering Python takes much longer, but you don't need to become a master to get things done!
Read more about how long it takes to learn Python.
AI is advancing so quickly - should I still learn Python?
Absolutely, Python remains essential in the AI field. It's foundational for developing AI technologies and continuously updated to integrate with the latest AI advancements. Python libraries like TensorFlow and Keras facilitate efficient building and training of complex AI models. Learning Python also ensures you understand the underlying mechanisms of AI tools, making you a more proficient developer.