Practice Python

Beginner Python exercises

28 May 2016

About

What is Practice Python

Practice Python was created as a side project to provide small, short, and relevant introductory Python programming exercises for beginners. When I worked for MEET as a computer science instructor, I had a hard time finding Python exercises that were small, self-contained, and suited for beginners. Many resources online, while thorough, were partially inaccessible to complete beginners. Mainly, the exercises were given without context. I recognized many of the problems as arbitrary and distinctly computer-sciency. They were all about sorting lists, class-design of different kinds of students, and searching through lists of strings. I wanted to provide easier problems that were more relevant to someone interested in learning Python or programming in general. Long-term, I want to provide Python resources for learners and educators alike - Practice Python is the first step. Read more at Why Practice Python.

Exercises

Practice Python is written and maintained by me, Michele Pratusevich (personal site, github profile). The blog is roughly monthly, with an exercise that comes out one week and a solution for that exercise that comes out the next week. As I experiment with this site over time, the frequency might become more or less frequent. If you have opinions, please feel free to let me know!

In each exercise post, I will post a small tidbit of Python 3 (an explanation, a library, a sample function) and pose an exercise that relates to the explanation / sample written in the post. The exercise should take no more than 30 minutes to solve and test. I will also try to include links to external websites that explain concepts in a simple way. The exercises will vary in difficulty from week to week. Check out the explanation of the chili difficulty system for more information.

Solutions

This site has regular exercise postings, and if you are quick to submit your solutions, they will be featured on the next week’s solution post!

Your Solution

At the bottom of every post, there will be an embedded Google Form where you will submit your solutions. The way to submit solutions will be through an anonymous Gist. This is like pastebin, except I can automate some scripts to make processing solutions easier for me.

All you need to do is go to http://gist.github.com, paste your code into the text box (not the Disqus comment box), and Create a Public Gist. You can even do this without a Github account! The link that is created with your code is the submission link that you will put into the form at the bottom of every exercise post. That’s it! (Note: if you want to make a Github account and keep copies of your code for yourself as gists, feel free to do that as well).

My Solution

I will post a few submitted solutions and comment on them, so you can see examples of other people’s solutions. In my comments I will refer to general coding style and methodology as well as Python coding conventions. In the event that my solution differs significantly from posted solutions, I will post my solution as well. You can check your submitted solutions against the posted solutions to see how you did.

Follow along

If you like the idea of Practice Python, want to do the exercises, or just want to get notified about a new exercise or post, you have a few options:

  1. Add this blog to your Feedly feed, by clicking on the link in the top right corner of the page, or clicking here. follow us in feedly
  2. If you don’t have Feedly but use some other RSS reader, add this blog to your RSS reader by clicking the RSS icon in the top right corner of the page, or click here. Atom feed XML
  3. Sign up for the Practice Python email list and get emailed every time a new exercise, solution, or post comes out. (Yes, it’s still a Google Form, because it’s free!)

About the author

My name is Michele Pratusevich, and in my day job I am a research engineer. This means I do a combination of research and engineering, mostly for computer vision problems. I use Python daily, and constantly am looking for interesting Python tidbits and tricks. If you want to learn more about me, check out my personal site. Previously, I got my bachelor of science and master’s of engineering from MIT in Electrical Engineering and Computer Science.

A picture of me

Getting in touch

I welcome any and all feedback about the site. Are exercises too easy? Do you want to interact with other readers? Do you want to interact with ME? Please get in touch with me via email - mprat@alum.mit.edu. I will get back to you as soon as I can. If you are a teacher and interested in using the exercises in the classroom, go right ahead! All the exercises are published under the CC-BY-4.0 license. If you do, I would love to hear your experience and incorporate any feedback.

Getting started

Ready to get started? Start with Exercise 1, or visit our resources for learners page to find Python books, courses, and online resources to help you along your journey.

Share the fun!


comments powered by Disqus