Learning Python can be difficult. You can spend time reading a textbook or watching videos, but then struggle to actually put what you've learned into practice. Or you might spend a ton of time learning syntax and get bored or lose motivation.
How can you increase your chances of success? By building Python projects. That way you're learning by actually doing what you want to do!
When I was learning Python, building projects helped me bring together everything I was learning. Once I started building projects, I immediately felt like I was making more progress.
Project-based learning is also the philosophy behind our teaching method at Dataquest, where we teach data science skills using Python. Why? Because time and time again, we’ve seen that it works!
But it can be difficult to build Python projects for beginners. Where do you start? What makes a good project? What do you do when you get stuck? In this article, we’re going to talk about:
- What you need to do before you build your first project.
- What makes a successful project.
- Strategies to use when you get stuck.
- Examples of how to select the perfect project.
Why Building Projects Is the Best Way to Learn
First, let's take a look at why a project-based learning approach is so effective.
Motivation: Have the Momentum to Keep Going
First, building Python projects helps you learn more effectively because you can choose a project or topic that interests you.
This helps you stay motivated, which is important in preventing you from giving up when things get tough.
Efficiency: Only Learn What You Need To
The second reason a project-based approach works is that there's no gap between learning the skill and putting it into practice. You won't waste time learning irrelevant things, because you’ll be actively trying to learn the specific things you need to build your project.
This also means you will get where you want to go a lot faster. If you’re trying to learn Python for data science by building data science projects, for example, you won’t be wasting time learning Python concepts that might be important for robotics programming but aren’t relevant to your data science goals.
Problem-Solving: Learn the Key Programming Skill
Problem-solving is a key skill when working with Python (or any other programming language). When you're building a project, you're going to have to come up with ways of approaching problems and solving them using code.
Building projects thus forces you to practice what is perhaps the most important skill in programming. And the more practice you can give your brain in solving problems with code, the faster your skills will develop.
Portfolio: Use Your Projects to Help You Get a Job
The fourth and final reason that building Python projects works for beginners is that you can get a head-start on getting your first job (if that's your goal).
When employers are looking to hire entry-level candidates, they want to see that you have the key skills they need. A great way of achieving this is having a portfolio of relevant projects that demonstrate your skills.
If you’re looking for your first job in the field, employers are going to want to see tangible proof of your Python skills. In other words, they’re going to want to see what projects you’ve built.
If you're interested, you can read more about building a portfolio in our Data Science Career Guide (which while aimed specifically at people looking to get into data has advice that's equally valuable if your goal is another application of Python!).
Before You Build Your First Python Project
If you have some programming experience, you might be able to dive straight into building a project. For most people, however, you'll need to take a little time to learn some of the basics of Python first. The idea here is to spend a small amount of time to learn these basics so you have what you need to dive into projects.
There are a few resources that you can use at this stage:
- Dataquest – Python Programming Fundamentals. At Dataquest, we teach Python in the context of learning data science. This is the first course in our curriculum, and it's free to sign up and start. Give it a try!
- Codecademy - One of the best-known sites for learning the basics
Once you have learned some of the basics, it's normal to feel a bit overwhelmed. You are learning something totally new, after all. Even though you might not feel ready to start building a project, you probably are.
As a first step, you might like to try building a structured or guided project. Structured projects are important because they allow you to build something without having to start from scratch, which can be difficult if you're a beginner.
At Dataquest, we include guided projects in every course which are designed to help bridge the gap between learning from a course and being able to build a project on your own. An alternative path would be following along with Python tutorial blog posts that you can find on either the Dataquest site or on thousands of other sites online.
What Makes a Great Python Project for Beginners?
Now that it's time to build your Python project, you need to decide what to build! Choosing what to build is extremely important — it will impact whether your project will be successful or not. So what makes for a great Python project for beginners?
Choose a Topic You're Interested In
The first and most important factor is choosing a topic that interests you. If you're interested in what you're building, you'll have more motivation. Motivation is important because it's the momentum that carries you through when you hit roadblocks (more on that later!).
Some people might be motivated by sports, others by a project that relates to social good. Others might be motivated by something to do with finance or the stock market. You might be obsessed with movies or a favorite TV series. Whatever that "thing" is for you, that's what your project should be about.
Think about your goals
The second factor to consider is what your overall goal is in learning Python. If you want to get into web development, then a project that builds a small web app is ideal. If you want to get into data science, then a project that analyzes a dataset is a good choice. By aligning your project with your goals, you'll be taking yourself closer to your eventual goal, rather than going on a "detour".
The last factor is not being too ambitious. It's natural to come up with a grand plan, e.g. "I want to build a website that allows people to build custom shot charts of using NBA data." This project idea sounds like it is based around a motivating topic (presuming you like basketball) and intersects with a goal (learning to make websites).
The difficulty with this project choice is that it's too big. In order to execute it, a beginner will need to learn the basics of building an online application, how to store and retrieve a large amount of data, how to create shot-chart visualizations, and how to display them to a user upon request.
It's much better to start with an extremely small and simple version of your project and then add more functionality later. If you don't, it will take a long time before you get any sense of accomplishment from finishing and you might even give up. By starting small and expanding, you're much more likely to have success.
A better version of this project might be to create a simple web app that will show a single NBA statistic for a small selection of players. Once you've built that, you can choose to expand it out by adding more players, more statistics, or any other extra piece of complexity that might appeal to you.
Building Your Python Project: Roadblocks and Difficulties
You've learned the basics of Python, completed a guided project, selected the perfect topic for your first solo project, and you're ready to get started. After about half an hour, you run into a problem: there's something you don't know how to do!
I promise you that this will happen, and it's not a nice feeling. No one likes getting stuck. That said, what you're being presented with is an opportunity. These moments — roadblocks — are where the learning actually happens. The key is knowing how to research to get yourself around the roadblock and keep working.
The good news is that most of the time, someone has been in the same situation — with the same roadblock — as you are in right now. What you need to be able to do is find the resources left behind by those people. Enter: Google (or your favorite alternative search engine).
How to Search for Help
The key to being able to find help is constructing a search for information about a general version of the thing you want to do.
Say you have a Python dictionary where the keys of the dictionaries are NBA player names and the values are how many games they've played. You're trying to find out which player has the most games.
Searching for “how to find out which NBA player has the most games in Python dictionary” probably isn’t going to be helpful, though. You need to construct a general form for your question, which in this case might be: "Find which key of a Python dictionary has the maximum value."
Finding these general question forms can be tricky at first, but this is an important skill that almost every programmer uses daily, so don't be afraid to dive in there and get some practice. If you still can't find help, you might need to break your problem down into smaller chunks and search for each 'chunk' individually.
You'll find that most of your searches for help will end up on one of three places:
- An online tutorial that explains the thing you want to do.
- Stack Overflow (an online programming Q&A site) thread of someone in a similar situation.
- The documentation for Python or the Python library you're using.
If you still aren't finding the answers, you should post your question on a place like Stack Overflow or the Dataquest community, where others might be able to answer your question. You may be surprised by how quickly other programmers will jump in to help out a beginner!
Now let’s look through a few fictional examples of people with interests and goals, and see how they can choose a Python project that suits their needs.
Danielle wants to break into the data science space, and she's identified that an entry-level job in data is going to be an analyst type role.
She loves Star Trek, so she's decided that an ideal project would be to analyze some data related to Star Trek episodes.
In order to start small and build up, she's going to find a data set and summarize data about episodes (she'll probably use this list of places to find free data sets for projects to get started).
Once she's done that, she plans to expand her project by creating some visualizations.
Fun Python project ideas for building data skills:
- Find out How Much Money You've Spent on Amazon — Dig into your own spending habits with this beginner-level tutorial!
- Analyze Survey Data — This walkthrough will show you how to get Python set up and how to filter survey data from any data set you can find (or just use the sample data linked in the article).
- Dataquest's Guided Projects — These guided projects walk you through building real-world data projects of increasing complexity, with suggestions for how each project can be expanded.
- Analyze Everything — Grab a free data set that interests you and start poking around! If you get stuck or aren't sure where to start, our Python courses are here to help you, and you can try them for free!
Greg wants to learn Python in order to build games for fun and loves puzzles.
Greg has decided that he's going to learn Python by building games using the Pygame library. He'll start by building a structured project using some Pygame tutorials and then go onto create a simple version of Rock–paper–scissors before gradually increasing the complexity of his projects.
Fun Python projects for game dev:
- Rock, Paper, Scissors — Start your Python learning journey with a simple but fun game that everybody knows.
- Build a Text Adventure Game — This is a classic Python beginner project (it also pops up in this book) that'll teach you a lot of basic game setup concepts that'll be useful for more advanced games in the future.
- Guessing Game — This is another beginner-level project that'll help you learn and practice the basics.
- Mad Libs — Learn how to make interactive Python Mad Libs!
- Hangman — Another childhood classic that you can make in Python to stretch your skills.
- Snake — This is a bit more complex, but it's a classic (and surprisingly fun) game to make and play.
Wanda wants to get a job building websites using Python, and she loves fitness and exercising. She's going to start by following a tutorial for the Python flask web framework, and then try to build a very basic website that she can use to log each time that she exercises.
Once she's built this simple version, she plans to expand and add new features one by one.
Fun Python projects for beginner web devs:
- URL shortener — This free video course will show you how to build your own URL shorterner like Bit.ly using Python and Django.
- Build a Simple Web Page with Django — This is a very in-depth, from-scratch tutorial for building a website with Python and Django that even has cartoon illustrations!
App Dev Aaron
Aaron wants to learn Python so that he can build apps for mobile devices and the web.
Fun Python projects for aspiring developers:
- Password generator — Build a secure password generator in Python.
- Use Tweepy to create a Twitter bot — This is bit more advanced, as you'll need to use the Twitter API, but definitely fun!
- Build an Address Book — This could start with a simple Python dictionary or get as advanced as something like this!
- Create a Crypto App with Python — This free video course walks you through some API use and Python to build apps using cryptocurrency data.
Each of the examples in the previous section followed the advice on choosing a great Python project for beginners:
- Think about what you're interested in and choose a project that overlaps with your interests to help with motivation.
- Think about your goals in learning Python, and make sure your project moves you toward those goals.
- Start small. Once you've built a small project you can either expand it or build another one.
Now you're ready to get started. If you haven't learned the basics of Python yet, I recommend diving in with Dataquest's Python Fundamentals course.
If you already know the basics, there’s no reason to hesitate! Now is the time to dive in and find your perfect Python project.
(If you're stuck for ideas, this article contains lots of ideas as well as some resources for structured projects.)
Data Scientist at Dataquest.io. Loves Data and Aussie Rules Football. Australian living in Texas.