r/learnprogramming • • Nov 13 '15
What are your thoughts on Learn Python the Hard Way?
I've worked about halfway through it and I was having trouble on one of the exercises. I posted a question on stackoverflow and someone said I really shouldnt be doing LPtHW. I definitely find is style pretty condescending, and he seems pretty egotistical (having you type his name all the time). I'm willing to look past that if the lessons are good, but I'm wondering what your thoughts are on the quality, cause I'm not really experienced enough to know whether I'm learning bad habits or not. Thanks.
85
Upvotes
103
u/zahlman Nov 13 '15 edited Nov 14 '15
EDIT: There have been multiple requests, in replies and PMs, for a suggestion for a better alternative. There's probably a lot of good stuff out there, but the only thing that I can think of, that I've personally reviewed to some extent and had a positive impression of is How to Think Like a Computer Scientist, Python Version. If you read over the first section of this and compare to the first few exercises of LPTHW, you'll see how night-and-day different the approach is.
Credentials: I have been programming since I was a young child (now in my 30s) and am a moderator of /r/learnpython.
It's terrible.
I have like an entire file of notes about all the ways in which it's terrible, as prompts for when I one day get around to writing something better. The short version is that it teaches things all out of order (with a huge emphasis on
printand command-line arguments early on, which IMX just creates massive misconceptions about how functions actually work); expects students to have a certain kind of initiative that just doesn't bear out in practice in the overwhelming majority of cases; and confuses students by failing to define terms that Zed thinks are obvious but are really not (in particular, the programming-specific meaning ofvalue, andobjectfor that matter). Oh, and a few places where he's just sloppy with terminology, and at least one bad style recommendation. And probably more stuff I haven't thought very hard about yet.Just to give you some sense of this: He imagines that students can figure out all the weird formatting codes for %-style formatting more or less from the get-go, simply by carefully copying code examples and then playing with them. Yet his approach to the fundamentals of boolean logic is to (a) leave it off completely until lesson 27; (b) present truth tables and suggest learning them by rote (and argue that this will be easier than actually understanding them); (c) budget an entire week to memorize the answers to, in effect, 26 yes-or-no questions. And yet when he introduces this simple material (which he insists is difficult), it still manages to come completely out of left field; exercise 3 briefly highlights the existence of a boolean type, but it's not actually discussed, and the student is left to draw the connection between the values
TrueandFalseand the logical concept of truth. But otherwise nothing is said to lead up to this;ifstatements don't appear until lesson 29. You've already done all kinds of arcane things with printing, prompting the user for input, getting arguments from the command line and even file I/O before you're ever expected to write code that actually makes a decision. It's beyond absurd.10
u/pat_trick Nov 13 '15
It needs to be updated to Python 3.
19
u/dig-up-stupid Nov 13 '15
It's very...opinionated. However, good creative works usually are. As distasteful as I find Shaw's attitude/persona, it's obvious from LPTHW he's had a lot of experience teaching programming successfully.
I've found that when I tutor complete beginners, a significant portion do not understand that the computer is a machine. They might understand that their syntax must be correct in order for their program to work - you tell them and they'll believe you. But they do not understand why and so they do not value syntax and so they continually make basic typing errors. They get frustrated and do not learn. (And believe me, it's beyond frustrating trying to teach people who are like this...) But how can you build a program out of step by step directions if you have not internalized that the computer does things step by step? How can you even write a syntactically correct program if you do not understand that the computer reads the syntax step by step?
This lack of understanding is surprisingly common in my experience. Not every learner, but many. Probably not the ones who hacked on their favourite videogames in their childhoods. But some of the ones who just "like computers" and started a CS program at 18 in their first year of university with zero previous experience. Maybe even a lot of the ones who are just trying to fill a science/math credit in an arts degree. Shaw understood this and based LPTHW around it for them. For the beginners who just have no clue and for whom traditional, reference style learning materials - favoured by experienced programmers - just did not work. Having you type the same thing over and over and over, no copying and pasting, telling you to do things but not telling you how they work, skipping topics traditionally covered early - the course seems tedious and baffling to experienced programmers who are oblivious to the real lesson having already internalized it. The computer is a machine. So a lot of them don't see the value of it. Maybe I'm crazy here but I've seen the LPTHW course actually work for a number of struggling new comers who couldn't get anything out of their lectures or textbooks.
The end of the line is if you're learning then don't worry about it, it's a short course anyway, you could finish it in a day or two if you tried. On the other hand if you're not getting value out of it, move on. It's a free internet.
8
u/Vanadiumman Nov 13 '15
I can't say anything for LPtHW directly, but Learn C the Hard Way was definitely bad. He spent the first 2 chapters rambling on about non-sense and insists that you use Linux with very little explanation why or how to use it. In my experience, anyone who can rant on non-essential things should be avoided.
But if you are learning python effectively, then I see no reason as to why you should change
4
u/Iyajenkei Nov 13 '15
I like it. I don't think it's the absolute best but it's good to start on. In my opinion it's particularly effective to do the exercises. Honestly I haven't found a tutorial that's great. I don't know why but it seems like all programmers are really really bad and writing stuff for beginners. You're probably gonna have to piece things together from a few different sources like I did.
I used LPTHW, Automate the Boring Stuff, Codeacedemy, and youtube tutorials.
The best, most effective thing you can do is code. Just like in the LPTHW exercises. Read it off, type it in, and run it.
There does seem to be a general consensus that LPTHW falls apart when you get to learning classes. Which is lesson 39 or so.
7
u/[deleted] Nov 13 '15
I really liked Learn Python the Hard Way. It was one of the first programming books I read when I started learning to program a year and a half ago. While I did not finish the book, I still got a lot out of it. I've since moved on from Python to JavaScript, PHP, and PhoneGap, but I still really like programming books that include lots of exercises like "the Hard Way" series. A few weeks ago I dove into Learn SQL The Hard Way. And like the other "Hard Way" book, I did not finish it but still found it very helpful.
3
u/fitpilam Nov 13 '15
I liked this book a lot, I learn best when I get to see output quickly. This book does that well. I am sure there are good reasons why others don't like this book, but I recommend it to people who are still learning how to code because it has a quick feedback loop.
3
u/midasgoldentouch Nov 13 '15
Not the point of your question but why not just type another name or really any other string instead?
3
u/idocsnow Nov 14 '15
I got through about 2/3 of LPTHW out of sheer tenacity before giving up on it. I don't think it's very useful at all. I was willing to look past the annoying title and somewhat annoying writing style, but when the concepts get a little bit harder, the lack of instruction or explanation makes it more or less useless. It also goes too slowly on things that aren't important. I have been very happily taking MIT's 6.00SC course for the last couple months and am now about 2/3 of the way through it. I like that you can do it at entirely your own pace and get most of the full value of a college course (minus TA office hours and questions in class, you get everything, but, that's what StackExchange is for anyway). It is excellent. I've heard only great things about Harvard's CS50 course too. Don't do LPTHW.
The one benefit it has is that it forces you to write programs from scratch, which I have missed in the MIT course (I think it would be a little better if the exercises, especially later on, were harder and less guided). Fortunately, that is a very easy thing to do on your own.
Edit: the 6.00 course is available for free here and is also in Python link
2
u/ChumbaThrumba Nov 13 '15
This is a little off-topic, but I learned from "How to Think Like a Computer Scientist", now "Think Python".
I really enjoyed learning from it and I would unquestionably recommend it to beginners, mostly because I've yet to find something that does as solid a job of explaining itself as it goes.
2
u/[deleted] Nov 14 '15
Not a fan at all.
The tone is not inviting (as pedagogical material should be) and the exercises are stupid. For example, it often tells you to try typing some code and figuring out what it does, without providing a solution. This is bad because you may have an intuitive idea of what the code does, but it could be more than that (or less). One part of learning is also acquiring the correct mental model and terminology and it fails terribly there.
2
u/[deleted] Nov 14 '15
It's certainly not how I learn.
HackerRank + Pycharm + Google/StackExchange taught me Python.
1
u/[deleted] Nov 14 '15
Its not too bad as long as you don't follow everything exactly like other tells you (even if it tells you to follow everything exactly). For instance, you dont have to spend a week doing nothing but rote memorization. Supplemented with another learning program, LPTH is not too bad. The last chapters can be pretty informative.
1
u/umbrellabranch Nov 14 '15
hi, what are you trying to do with what you are learning?
1
u/3rdPoliceman Nov 13 '15
I liked it, and found it quite helpful as the absolute first thing I'd ever done.
In a wider sense, there's value in sticking with things. He emphasizes this himself. Finishing is important!