What did you find most helpful in learning Python?
June 18, 2020 11:35 AM   Subscribe

I'm starting my programming journey (again) and am figuring out what's the best way to learn. What book, online resource, video series, etc., did you find most useful in becoming a Python master?

Looking for educational resources to help me learn Python. My current goal is to make some kind of portfolio-worthy project that I can share with people online. I am familiar with programming up to but not including classes; so I know about different data types, loops, if-then statements, etc.

What would be really helpful would be something that facilitates a lot of actual coding, whether that's open-source projects I could contribute to, or a textbook full of exercises, or a YouTube series with links to Jupyter notebooks, etc. Ideally it would be very comprehensive too, covering the various data structures in Python, how to build and use classes, and basically anything else that a junior programmer would be expected to know. Bonus points if it points me in other directions to explore once I have the basics down.

I'm open to any venue, whether it's an actual textbook that I have to buy, a Udemy course, a hackerrank-type website, etc.
posted by miltthetank to Computers & Internet (19 answers total) 66 users marked this as a favorite
 
My usual go-to for this situation is Automate the Boring Stuff with Python. I only found it after I was well into learning Python, but it's what I always see being recommended when people are getting into the language. The online version is free, but there's a print version and a Udemy course (on which you can get a pretty substantial discount).
posted by Mr. Bad Example at 12:29 PM on June 18, 2020 [6 favorites]


Not the huge magenta-spined O'Reilly books. They're a couple of thousand pages of Well, Actually / Fedora Guy in paper form.
posted by scruss at 12:50 PM on June 18, 2020


I really liked Learn Python the Hard Way: https://learnpythonthehardway.org/python3/. The basic idea is concepts are easier to learn when you are actually using them, so the author has you dive right in and start writing and running little bits of code. It might be a little basic for your needs, but in that case you can fly through the exercises that are easy for you and get into the ones that explain concepts you're less familiar with.
posted by Tehhund at 12:55 PM on June 18, 2020 [1 favorite]


I really enjoyed the Python Challenge, a series of programming problems that are basically puzzles to solve. You’ll spend at least as much time on problem solving as actually learning Python, but that’s good exercise IMO.
posted by sjswitzer at 12:56 PM on June 18, 2020 [2 favorites]


There are a lot of sites with exercises out there, but my personal favorite is Exercism:

- free, no ads
- you code on your own computer, instead of inside a browser, so you pick up stuff about environment and tooling
- all the exercises are based on passing tests, and learning to write/use unit tests is really handy
- you can see other people's solutions to the same problem and learn from them

If you already know the basics, just skip ahead to anything that looks challenging.

If you're interested in data analysis or data science at all, the Python Data Science Handbook is comprehensive and well-organized, if a little dry.
posted by theodolite at 1:01 PM on June 18, 2020


I would not call myself a "Python master" (or, for that matter, "competent"), but my exposure to it is also via Learn Python the Hard Way. That was actually the first programming I did before I wandered off following other languages, so it introduced me to basic programming concepts. I found them easy to understand and the exercises useful.
posted by kevinbelt at 1:28 PM on June 18, 2020 [1 favorite]


If you are learning to program, I recommend Allen Downey's Think Python which is available as a printed book or for free as HTML or PDF on the web. (Earlier versions of this book were called Python for Software Design and How to Think LIke a Computer Scientist)

If you are a more experienced programmer, the first few chapters of the O'Reilly Python In a Nutshell make a dense introduction.

For an online tool that complements the books, I have heard good things about Python Tutor but haven't used it myself.
posted by JonJacky at 2:06 PM on June 18, 2020 [1 favorite]


You might check A collection of free books from Springer (previously), there are a few Python books there. Maybe something like Data Structures and Algorithms with Python.

Sorry, not a Python person.
posted by zengargoyle at 3:30 PM on June 18, 2020


I liked Python For Everybody. He explains things super clearly and often very literally illustrates what he's talking about, which helps me as a semi-visual learner.
posted by thebots at 4:50 PM on June 18, 2020


Oh yeah, something else I liked doing was browsing Kaggle and Kaggle Notebooks. Just seeing the cool projects and some examples of workable code was super inspiring and educational. Their tutorials are also pretty decent for getting a data science taste of Python.
posted by thebots at 4:54 PM on June 18, 2020


Best answer: Check out Peter Norvig's pytudes, dozens of short but deep Python etudes (case studies). Many are Jupyter notebooks, others are just .py files.
posted by JonJacky at 6:23 PM on June 18, 2020


This online course from MIT and EDx is very good, and it just started a couple of weeks ago so it should be easy to catch up. There are a lot of exercises to do, but they build up gradually so they're not overwhelming. And you end up learning a lot about computational thinking, analytical thinking, designing algorithms and so on.

It takes three months to complete, and it should be doable with about ten hours per week of studying and working on the exercises. Part Two of the course is also very good, where you learn about Monte Carlo simulations.

If you like algorithms, HackerRank is a fun place to explore their algorithm puzzles and practice coding in Python. After you've done one algorithm, it's helpful to read the comments to see how other people have done it.
posted by Umami Dearest at 10:33 PM on June 18, 2020


I came here to nth Python the Hard Way. I like the chapter headings for Automate the Boring Stuff with Python.

You've not said what you've tried before, what caused you to give up and why you're trying again. Those might be factors in the kind of course that works for you. Some of programming is about modelling the problem you have in the computer, some of it is transforming data in the computer to make the model or to solve the problem, and some is about identifying workflows from the offline world that you can model within the computer to turn some manual rote-work into something you oversee a computer doing for you. Both The Hard Way and The Boring Stuff cover some of this.

Good modelling skills are something you learn by doing. Undergrad courses teach 'data structures', investing students in learning a toolkit of data structures in the computer that work as a kind of langauge for thinking of the problem as it will take shape within the computer. That's to say that we each need something that helps us empathise or imagine how to get the computer to solve the problem in front of us. (I also like that learning by doing gives rewards for achieving goals.)

Good luck, and keep plugging away when it's hard to work out what's wrong with your mental map of 'this should work' versus 'this is what the computer needs to do this right'!
posted by k3ninho at 11:57 PM on June 18, 2020 [2 favorites]


Best answer: Seconding the Python Challenge! It's designed to introduce you to the standard library little by little, while forcing you to read (and get familiar with) the documentation.

I also really love Project Euler. It's a collection of bite-sized problems designed to be solved with the help of programming.

Finally, you might want to check out CodinGame. It's also challenge-based with a surprisingly nice in-browser IDE. The best part here is the competetive bot-programming challenges, with a variety of games to compete in going back many years. I found this site after the old Google AI Challenge stopped running.
posted by dbx at 6:57 AM on June 19, 2020 [1 favorite]


Best answer: I haven’t used it but I’ve heard good things about David Beazley’s Practical Python Programming. It’s the materials for the course he’s been teaching in-person since 2007 and I think he’s only recently put it all online, for free.
posted by fabius at 10:31 AM on June 19, 2020


Best answer: The thing that helped Python stick for me was Colt Steele's Python 3 Bootcamp. He has a really great manner which I found really approachable. It starts with the super basic essentials (which I already knew, but still found helpful to review), and goes pretty advanced (scraping, decorators, generators, etc.)

I also found Learn Python the Hard Way to be pretty good.
posted by taltalim at 1:03 PM on June 19, 2020


Response by poster: Thanks for all the answers, everybody! Yesterday I bought Jose Portilla's Python bootcamp course on Udemy. Also very intrigued by Beazley's PPP.
posted by miltthetank at 2:07 PM on June 19, 2020


I don’t have a book to recommend, but something that helped me improve my Python faster is Jupyter/IPython Notebooks.

There’s a few mentions of them already here, as prewritten resources to learn from, and they are a very nice way to present and explain code, but as a programming environment they can do a lot to reduce the context-switching that traditional write-in-text-editor/execute-in-terminal tutorials encourage. You can edit each cell of the notebook and run them in any order, as many times as you like, with the output of each cell displayed below its own code (possibly as an image, HTML, graph, etc.)

Compared to experimenting and debugging in the command line, notebooks let you work with larger chunks of code, and you can edit them more easily in a browser textbox before re-executing.

Compared to writing in a text editor, notebooks give you quicker and better-contextualised output to each chunk of what you’re writing. Because the interpreter is running in the background, you also get help and tab-completion on dynamically-assigned variables, which static analysis can’t always do.

PyCharm is a full IDE that I’ve been using more recently, but its interface is a bit more cluttered.
posted by polytope subirb enby-of-piano-dice at 3:23 PM on June 19, 2020


Python from Scratch is what made it finally stick for me.
posted by avocet at 3:58 PM on June 19, 2020


« Older where can I get a real bagel in Chicago?   |   My first Would-You-Eat-It question! Newer »
This thread is closed to new comments.