Try Tuts+ Premium, Get Cash Back!
The Best Way to Learn Python

The Best Way to Learn Python

Tutorial Details
    • Language: Python
    • Version: 2.X / 3.X
    • Difficulty: Beginner
This entry is part 3 of 5 in the The Best Way to Learn… Session
« PreviousNext »

Python is more popular than ever, and is being used everywhere from back-end web servers, to front-end game development, and everything in between. Python is a true general purpose language and is quickly becoming a must-have tool in the arsenal of any self-respecting programmer.

But Python isn’t popular just because it’s popular. It is easy to learn, reads like pseudo-code, and is wickedly agile. However, learning any new language can be a daunting task, and finding the right places and people to learn from is half the battle. That’s where this guide can help. This is your blueprint for making Python easy, fun and rewarding to learn.


Assignment 1: Start With the Basics

At the time of this writing, there are two main versions of Python in circulation: Python 2.7 and Python 3.2. Which you choose to learn really doesn’t matter too much, as the differences will be minimal—especially to a beginner. But you should know that, while Python 2 has far, far more 3rd party support, Python 3 is the primary focus of the developers designing the language. The choice is yours, but if your code acts differently to any given tutorial, make sure you use the same Python version used in the tutorial.

Wikibooks’ Non-Programmers Tutorial for Python

Wikibooks is always a great source to learn something new, and Python is no exception. Here you will find a solid and to the point series of guides that will teach you the ropes of Python. It doesn’t get too technical, and you can jump into coding something somewhat useful and rewarding pretty quickly. Because of this, I recommend this site as the best place to start on your Python journey.

The Official Python Tutorial

You won’t find a better source of information than the official python.org documentation. However, if you want to jump right in, as I’m sure many of you will, this might not be the best place to start.

The content tends to be more technical than wikibooks, which will be helpful later on as you progress through the language. But, for a beginner, it may just get in the way of what really is a very simple and beautiful language.

For beginners, the biggest difference between Python 2 and Python 3 will most likely be that Python 2 can use print without parentheses. Python 3 requires parentheses, but that’s all.


Assignment 2: Tutorials and Screencasts

TheNewBoston’s  Python Programming Tutorials

TheNewBoston’s playlists are always great, and you can learn a whole host of languages. ‘Bucky’ is a great instructor because he strikes a really great balance between being funny while also being easy to listen. I highly recommend any of his playlists—especially his Python playlist. He assumes zero prior knowledge of programming and will leave you with a firm grasp of the language.

Nettuts+’s Python from Scratch

A little closer to home is Giles Lavelle’s intro to Python. Like TheNewBoston’s series, Lavelle also assumes zero prior programming experience.

If you want to see some real-world applications of your applications, or would like to aim towards web development with Python, this series might be the one for you.

The screencast takes you from nothing to building a dynamic website using a Python web framework called Django.

ShowMeDo’s Python Screencasts

StackOverflow isn’t just full of ‘newbie’ errors and problems.

ShowMeDo has a huge catalogue of Python related videos. While it may not be the most user friendly experience around, the videos range in level from absolute beginner to the most advanced Python techniques. It is well worth checking out.

Build a Python Bot That Can Play Web Games

This tutorial is pretty specific in terms of what you’re going to learn, and I do not recommend it for a complete beginner. I feel, however, that it’s worth a mention. In this guide, Chris Kiehl shows you how to build a very interesting Python bot that will play a simple game for you. The tutorial really goes to show the power of Python; it can be applied to do everyday repetitive tasks that you may have on your computer.


Assignment 3: Free e-books!

Its hard to beat a good book when your trying to learn something new, and with the great community that has developed around the Python language, there is a plethora of free high quality e-books to choose from. Below is a quick list of some of the best. You can download a free e-book version for each of them, or you can choose to buy the physical book (or donate) if you want to support the author, which I’m sure they would greatly appreciate.

Learn Python the Hard Way

Despite the name, Learn Python The Hard Way makes learning Python incredibly easy—the way it’s meant to be! In this book, Zed A. Shaw works from the ground up giving you a detailed and comprehensive guide to Python without getting in your way of the actual coding. Shaw is informal but thorough, making the book an easy but rewarding read.

Think Python: How to Think Like a Computer Scientist

You won’t find a better source of information than the official python.org documentation.

As the sub title might suggest, “How to think like a computer scientist”, Think Python stays a little more towards the theoretical side of things. This may prove a little frustrating for a total beginner, but the book is well worth the read in regards to algorithm theory and high level concepts.

Invent With Python

If ‘learning by doing’ is your thing, then building your own game will prove to be a rewarding experience! In this book, Al Sweigart assumes no prior knowledge of Python and takes you all the way to building your own game. Given that the book is geared towards game development, the book may move a little quickly for a total beginner. Later on in this article, I mention a similar book of his where he assumes a prior knowledge of Python. If you feel you are have a good grasp of the language, then his other book might be a better resource for you.

The Django Book

If you want to learn Python for web development, then you’re probably going to be using the Django framework. This book assumes fluency in Python, but it teaches Django as if you are a beginner to the framework. The Django Book is as good as they come and will be invaluable for any budding web developer.

Python Books

If you don’t have enough to read yet, or want a book on a specific topic, then you should follow this link. The folks over at python.org have complied an extensive list of books, sorted by difficulty and topic.


Assignment 4: Get Familiar With StackOverflow

Thousands of developers have experienced every problem that you are bound to face. StackOverflow is a great resource where developers find solutions to their problems. When you happen upon an error that you’re not sure how to fix, search StackOverflow. You will more than likely find a solution and how other people solved their problem.

But StackOverflow isn’t just full of ‘newbie’ errors and problems; there are some really clever and helpful people that use the site – learn from them!

Take a look at the Hidden features of Python thread, for example.

Many of the tips and tricks you see here may not be covered in many formal tutorials, but they will be extremely helpful for intermediate to advanced Python users.


Assignment 5: Project Euler

Project Euler (pronounced ‘Oil-er’, to save you some embarrassment later on) is one of my favorite websites. After making an account, you can work through the ~400 problems on the website. Each problem is about 50% mathematics and 50% programming and, in my opinion, the most rewarding way to learn more of either subject.

The problems start off easy to test your knowledge of the language, but grow in difficulty to challenge even the most seasoned programmers. Eventually, the difficulty of the problems will force you to find the most efficient algorithm – that is if you don’t want to wait hours to compute the answer.

Nothing will turn you into a programming wizard more quickly than pushing yourself for the fastest and most efficient solutions to the Project Euler problems.

When you crack a new problem, you gain access to that problem’s forum thread where many people discuss their solutions and ideas with one another. Many of the solutions in later pages of the thread will be in Python. This is really the key to growing your programming prowess. If there is someone with a solution that is faster than yours, take the time to analyze it to see where you could improve your own solution. Over time, you will pick up all the tricks of the trade and grow your Python knowledge in a meaningful and rewarding way.

Additionally, there are also some really great blogs that work through the Project Euler problems in Python. If you are stuck on a problem, there is no shame in having a sneak peak at other developers’ work, as long as you intend on learning from it. Here are two of my favorite:


Assignment 6: Build a Game

Few things are more satisfying than building your own game.

Few things are more satisfying than building your own game. It can be a steep learning curve, but well worth it and very rewarding. PyGame is the best known game library for Python, and you will be able to find many free tutorials on it. Here are some of the best PyGame tutorials. 

Official PyGame Documentation

As with the case of the original Python tutorials, the developers of PyGame also have their own intro documentation. But these may be overly technical if you want to jump straight in and start building your game. Developer documentation, however, will always be your best source of information; so, I still recommend you get familiar with the site.

Invent With Python (With PyGame)

This free e-book by Al Sweigart runs through the PyGame library, taking you from zero knowledge to building a couple of games for yourself. The simple games will provide you with a perfect platform to start your own projects, if you are so inclined. Sweigart provides extensive and detailed comments throughout all of his code to help you learn as you go.

TheNewBoston’s Computer Game Development Tutorial

This is another Playlist from TheNewBoston. It serves well as an intro to PyGame. It assumes zero knowledge and gives you a good feel for the PyGame library, but unlike the InventWithPython guide, it is more to the point and won’t bring you to making your own full game.


Assignment 7: Get to Know Some Common Libraries and Tools

Python is a general purpose language that can do almost anything; so, of course, there is a seemingly endless supply of libraries and tools out there. Here are some of the most popular.

PyPy

If you ever want to scrape a HTML for some information… BeautifulSoup will do all this for you and add years to your life.

If you are doing some CPU intensive work, and you find that Python is proving itself to be a bottleneck, then maybe you need PyPy. PyPy is an alternative compiler for Python that can really speed up your processing.

NumPy + SciPy

These two usually go hand in hand (SciPy is dependent NumPy). If you are doing some serious number crunching for mathematical or scientific research, then these two libraries will be your best friends. NumPy and SciPy extend the mathematical functions and capabilities of Python and can greatly speed up some of your tasks.

BeautifulSoup

BeautifulSoup really is beautiful. If you need to scrape a HTML page for some information, you will know all too well the frustration and hair loss that it can bring. BeautifulSoup will do all this for you and add years to your life. Highly recommended and fun to play around with.

Python Image Library

The Python Image Library (PIL) is an extensive library that is great for anything to do with images. If you need to manipulate an image, chances are PIL can do it for you.

Django

As mentioned previously in the article, the Django framework is what you will probably use if your aim is web development. It is the most common web framework for Python and also has the most learning resources available.


Assignment 8: Get Involved in Open Source Projects

After you have a decent grasp of the language, being able to read and understand other people’s code is always an important skill to have – not to mention that it is a really great way to learn too.

For this reason, open source projects are great. Github or Bitbucket are the to go-to places for this. Don’t worry about people judging your code, you don’t have to contribute right away. You are always free to fork a project, tinker with it yourself, and see how things work. If you do happen to see something that you think could be improved, great! Go for it and submit your improvement. That’s what open source is for.


Conclusion

I hope I have been able to provide a solid base of Python knowledge for you. If there are other places of interest that you think should have been included in this syllabus, let me know in the comments below to help others out!

Tags: python
Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • Luis

    #awesome Post

  • Austin Conlon
    • http://www.jeremysweazy.com Jeremy Sweazy

      Yea, i use codeacadamy to learn the basics, it can be a little glitchy at times but definently a great resource

  • sh0x

    How about the Dive into Python book?

    • http://butenas.com Ignas

      I was also surprised this was not mentioned… “Dive into Python” and “Learning Python” (well this one is not for free) are the best books to start with Python IMHO.

  • http://www.pelican.com.my Edwin

    Just in time. I’m currently learning Python and this article is useful. Thanks.

  • Franklin

    Great tips, thx

  • http://andrewburgess.ca Andrew Burgess

    Excellent work, Mark! I’ve been trying to pick up some python in the last few weeks, so this is great. I’ve actually been reading “Learn Python the Hard Way”; it’s a great place to start!

    • chichibek

      great resource Andrew!

  • http://www.tailwindcreative.com Jon Hainstock

    Codeacademy.com offers some free Python courses. I haven’t personally tried them yet but I have gone through the Javascript ones and have learned a lot. Codeacademy provides an easy way to get your hands dirty in the code and see some instant results. http://www.codecademy.com/tracks/python

  • Quintn

    I love your posts. Everyday I find something so dang useful on here. It would be sweet to have a segment like this for all different kinds of languages. This was so helpful. Thank you!

  • http://www.webhipster.com Vincent Young
  • Neri

    Code Academy also has a free online learning track for Python. I’ve been taking the course myself and have found it to be useful. Great list of resources.

  • jbeja

    Some 2012 books that i am reading to learn python “Core Python Applications” (3 edition is what i am reading ) is the best book to now what exactly you can do with python. “Make Games with Python and Pygame”. And this last one is a little way off from the scope and is from 2010 but is good to any programmer “Python Algorithms: Mastering Basic Algorithms in the Python Language”.

  • http://davidpuerto.com David

    Code Academy?

  • PJ

    Isn’t The Django Book a little bit outdated? It hasn’t been updated since 2009 (according to table of contents) and it covers Django 1.0 – right now we’re on 1.4.1… Not that I’m complaining, it’s still a great resource for getting grasp of Django basics, but I personally think that for “real” learning the Django Tutorial would be better. :)

    Anyway great list, thank you! :)

  • Leron

    I just wanted to mention that you can go through the Official Python tutorial in video format by watching Ryan Shea’s “Python Osmosis” series.

    http://python.sourcequench.org/
    http://www.youtube.com/playlist?list=PL4B416E115B44D973
    http://itunes.apple.com/ee/podcast/python-osmosis/id317462382

  • http://www.ijasnijas.com/ MOhamed IJas

    Y NO CREATE ‘LEARN PYTHON IN 30 DAYS’ ???

  • prabhu

    nice article!!But i highly recommend http://www.udacity.com/ ,its all about python, topics range from building your own search engine to programming a robotic car, taught by the folks at google!!

  • harish

    like @andrew said “Learn Python the Hard Way” is the best way to get started…

  • http://epc.geotech-apps.com Rey

    What a fantastic article. I started with Python about a year ago, and I really understood it well with the New Boston’s website. I hear “Learn Python the Hard Way” is also a great reference. Python is extremely fun yet powerful as a programming language. Definitely see myself learning more with the references you provided. My goal is to become a Python ninja. Thanks and I’ll be subscribing to your site!

  • Andre

    Can you please add CSS to this series? It would be a great help. I am currently, almost done with 30 days to learn CSS. Need further guidance.

  • ivanhoe123

    Thanks for the list! It would definitely be cool if you would post more Python related articles :)

  • http://www.gefeizhang.de gefei

    I like Stackoverflow and Project Euler. They are a must for learning every programming language, not only Python.

  • http://geekjets.com Filipe Manuel

    Congratulations! I’m beginner in Python and this article really will help.

  • http://@johnhaldson John H

    I’m surprised to not see Google’s Python Class included here. I have went through many of these tutorials before and Google’s Python Class was by far my favorite.

    http://code.google.com/edu/languages/google-python-class/

  • http://wysocki.org.pl Jacek Wysocki

    Also Python Koans: best for programmers with some experience https://github.com/gregmalcolm/python_koans/wiki/

  • Hunty

    Great article,

    your sentence ‘reads like pseudocode’ made me smile and think back to my first years in python, back in the Django 0.97 beta days.

    I presented a Django solution with some code snippets to a fully Perl/Java oriented audience. The Perl wizzard in the room asked when I would come around to implement the presented ‘pseudo code’. He was flabbergasted when I actually showed him the running example, live, as an answer.

    Note: I don’t have anything against Perl or Java, I use and program in it every day, but python is my first choice for most solutions.

    What me really got going was the installation of Eclipse with Pydev. Boy I hate it when I don’t have this combo at hand.

  • Rob

    It’s a great article, and will no doubt be a great help for so many. But please reads, keep in mind it’s not the perfect recipe.

    I am personally in the process of learning Python as my very first programming language. Surprising the hardest thing I struggle to get to grips with is the MASSIVE supply of 3rd party modules for importing. I’d also prefer to learn to do it the hardway before always relying on imported work that someone else did.

    Personally I preferred the idea of going for 3.x as the gap-difference between 2.x and 3.x is growing, and as a newbie I don’t have such a big need for 3rd party objects as experienced developers might do.

    ShowMeDo is not a good site. When I found this site I was excited, only to quickly be let down after realising you have to pay to access much of the content.

    The idea of getting involved in an open source project is easier said than done. The inet is actually a pretty hostile place, and people who might be happy to offer help on forums etc, are not often going to hold your hand and teach you how to code for their project.

    do check out http://www.udemy.com/learn-python-the-hard-way/ which compliments Learn Python the hardway. I original read Version1 of this book when I first started out. But Version2 just started to frustrate me as I saw it’s still based on 2.x so I moved on to Mark Lutz books, which although “Learning Python” is very poorly written, it does the job to get you up and running.

  • http://blog.hizup.com Gerald

    Hey, I like you good python tips ;)

  • http://www.davidportney.com/ David

    I’m a Python programmer wanna-be and picked up this book “Python Programming For The Absolute Beginner” and I’m not far into the book but the author’s tone is light and funny and unlike other books on programming, no prior knowledge is assumed. I’m finding this book to be very good so far for a beginner like me.

    http://www.amazon.com/Python-Programming-Absolute-Beginner-Edition/dp/1435455002/ref=sr_1_1?ie=UTF8&qid=1345650434&sr=8-1&keywords=learn+python+for+beginners

    • Rob T

      I also have this book and agree that it is an excellent book for newcomers to Python programming. A lot of the examples are focused around game programming however it covers all the basics and some advanced stuff.
      There is also a follow up book “More Python Programming for the Absolute Beginner” which is a little more technical and also uses Game Development examples.

      Both highly recommended for Python Newbies.

  • Slon86

    try http://www.checkio.org for practicing your skills. it’s for coders with at least basic experience but it has an amazing system of peer review when you constantly get feedback on your code while playing a game

  • http://aoberoi.me Ankur Oberoi

    Is it just me or is there no namespace.js created fromt he bbb init command nor during this tutorial. I’m getting 404′s on trying to load namespace.js

  • http://twitter.com/kanuj kanuj bhatnagar

    You could also add Google’s Python tutorials (http://code.google.com/edu/languages/google-python-class/). I started out from the NetTuts tutorials, but progressed with the Google code tuts. They’ve code puzzles to complement the video tuts too.

  • Pyguy33

    Funny Python Shirt – http://teespring.com/pythonlines

  • Paul Murphy

    Really nice article. I’ve been looking for a stepwise guide for a while. Thanks

  • Anonymous

    Great article! I’m just starting and this was exactly what I needed!

  • http://twitter.com/Magxtopher Igwe Magnus Nnamdi

    learn python the hard way is amazing.For newbies start with the command line crash course written by Zed A Shaw.It will wash you and refresh your brain….Zed A Shaw is amazing teacher.