Need a good book on programming

I read something on YouTube today in the LPTHW section and somebody said that this book is for someone that has programming experience. I agree, and have decided to put aside my LP3THW book and find a book that explains programming. I need to know why I’m doing what I’m doing. For example, why do I put print statements in parenthesis (however you spell it) and why do I put these : or why do I put (((this)))? It is easier to remember this stuff when you know why you are doing it. My first attempt to learn programming was with a $200 video course on VB6, and the first thing it said was, “we expect you to have some knowledge of programming”. It wasn’t two long before I realized I wasted $200. I’m sorry, this book might be one of the best out there, but for me it isn’t cutting it. So can some one recommend a book? I also have “The Self Taught Programmer” by Cory Althoff, but that uses IDLE and is confusing. I also have other books on programming but they are on other programs. So can anyone help me out here? Thank you in advance. Not2smart.

Automate the boring stuff with python i was learning from book it intended for novice programmer it also have supported videos with no cost but you have to google it . Besides all the resources you have to have the nerver giveup aproach

1 Like

I can sympathise with this @Not2smart as it’s can be overwhelming when you start.

But a computer language is exactly like a spoken language to learn. There are basic patterns in grammar and syntax that you have to get familiar with.

These are structured in a certain way, with basic constructs that programming uses, things like code blocks, functions/methods, classes.

Perhaps start with YouTube for some absolute beginner stuff. At the risk of sounding patronising, which isn’t intended, there are some good Raspberry Pi Python tutorials aimed at computing for kids that starts at point zero.

But don’t loose heart, it seems overwhelming when you begin but The Hard Way is all about repetition and practise. Like learning a new spoken language or an instrument. It feels insanely hard but then your brain gets it. Go back to ex1 if you like and start again.

In fact Zed recommenced this approach and I did the book twice before some of it sank in. And some still didn’t until I worked through other projects.

4 Likes

This person on YouTube is wrong, at least for me. I started to learn Python with a lot of books in English and German and after a while I thought I will never understand it. Then I found LPTHW. It was the first book which I got some accomplishments and finally brought me into programming. Without this book, I believe, I would never have learned how to program and, very important, how to think like a programmer. Zed’s teaching style is unique. I didn’t find any learning resource that comes close to it. You will not only learn Python but more, you will learn how programming and computers work and how you have to think to solve your problems.

3 Likes

You know, I might be down to actually write this up. I’ve been meaning to do a description of computation starting with light switches and going to parsing. Do you mind writing up a huuuuuge list of questions you have that I can try to hit in the writing? Also, maybe I’ll do it as a series of posts here so people can reply and augment it as I write it up.

Now, what you’re asking for is the grammar:

https://docs.python.org/3/reference/grammar.html

Teaching you to read that would be murder in a little post here, but try reading through that. Maybe that’s just what you need so you can look up every single rule and study it exactly.

The other thing is, I think you’re asking the wrong question, mostly because you don’t know what to ask. You ask “For example, why do I put print statements in parenthesis (however you spell it) and why do I put these : or why do I put (((this)))?”

But, that assumes the grammar above is some kind of force of nature that just exists. It is entirely constructed by a group of humans (you can see that construction in the grammar), so the answer is just “'cause Python people made it that way”. It’s like asking why do American’s drive on the Right side and Brits on the Left side of the road? There’s no force of nature that determined that. It’s just a group of people decided that and it stuck. Done.

The better way to word this is:

“What is the syntax for print() and : colons?”

That is exactly what you’re looking for, a grammar description written by the people who wrote python that shows you all of the rules exactly. Now when you say “why do I have to write X” change it up to “what’s the grammar/syntax for X”, then look it up in that web page.

Edit: The best way to figure that link out is look for keywords you want to know the rule for, in ‘quotes’. Let’s say you want to know the grammar for ‘class’. CTRL-f in your browser and search for ‘class’ and you find this:

classdef: ‘class’ NAME [’(’ [arglist] ‘)’] ‘:’ suite

The classdef is the name of this rule, so if you search for that you’ll see everywhere that you can put a classdef (when it’s on the right side of that first colon, it means you can use it there). Next is 'class' which is a raw keyword (a lexeme or token). NAME is then another token, but it’s most likely a variable token so there’s a rule for it. At that point you’d have to dig for the tokenizer code so just assume it means a token NAME, not another rule (because it’s uppercase). Now you have [ ] which starts an optional part, and inside that you can do '(' then another optional part [arglist], followed by ')'. After that you have your hated : which now shows you why you have to put there, because the grammar was written to require you to put it there. Finally you have suite. To figure out what that is (or arglist), search for suite: which will find the rule because it’ll find the word “suite” on the left side of a colon.

4 Likes

Try something at Udemy
It’s black friday discount (90% off) this week
There is even some courses for free.

It feels like there is a never ending discount going on :rofl: but they have a lot of good courses. I like the courses I bought from them.

Thanks for the advice about Udemy. Note to Zed, I understood about 2% of what you wrote. I think you were basically saying, it is what it is. I went to the link you gave and understood 100% of nothing. Anyway, I’m now having a problem with ex25 so I’ll just make a post about that and continue on. Thank you. As always, I’m Not2smart.:grinning:

Note to Zed, I understood about 2% of what you wrote. I think you were basically saying, it is what it is . I went to the link you gave and understood 100% of nothing.

Hey @Not2smart I was in the same spot, didn’t understand a thing … :scream: but anyway we have to move on. At some point we will understand it :man_student:

Pointless fact @zedshaw - I believe the British drive on the left as in the days of horses and knights, a rider would hold the lance in the right hand and therefore the had to ride on the left to joust the opponent effectively!

But yes, made up by people and it stuck!

So, that’s part of the problem with giving out a complete and total full explanation of everything to a beginner like yourself. There’s a big chicken-and-eggs problem where you need to understand these concepts in order to understand the concepts. For example, if you want to know why a colon goes in a spot, then you have to understand the grammar that python people wrote, but to understand that grammar you’d need to already be an experienced programmer.

There ends up being only about 2 ways to bust through this:

  1. Actually really taking the long time it takes to study each of these concepts until you do learn all of the details of it. So that means taking each piece of that file and finding out through your own research what all the words and concepts mean. So, you say you only understand “2% of what you wrote”, well then your next step isn’t to quit, but to go and research what the other 98% means. That’s one path, and I don’t recommend it really.
  2. Put aside the idea that to be proficient in something you have to totally fully understand the details before learning it. Instead, assume that by trying to figure it out like a puzzle you’ll gain enough insight and understanding that you’ll then be able to grasp the concepts or can research them further. This path is what my book does. It makes you write a bunch of code and break it and study it until one day you get it, and then you can go and research and study it more. The key to this is if you feel lost then you have to accept that as a normal part of the learning process rather than a sign that you’re stupid. This is a big leap for a lot of people because they’re used to being told that if they’re lost then they won’t naturally get it ever. That view is false though because nobody can really defined natural ability anyway, and plenty plenty plenty of people learn concepts that they don’t understand for years first.

So, to help with #2 (since #1 seems to be too much for you right now), you really should write up a huge list of questions for me to answer. I’m serious. Just keep a notes file of every question you get while you study. Then, try to answer those questions yourself through searching online and research, and any you can’t answer just come ask here.

2 Likes

Awesome @zedshaw you’re like the programming equivalent of one of this Kung Fu masters you see in the martial arts movies from the 80ties …

1 Like

I like Real Python tutorials for learning concepts and real-life applications. For broader questions, Stack Overflow has a lot of well-thought out responses to most programming questions.

To answer your question, though, I would suggest looking at Python code on Github open-source projects. Read other peoplr’s code and try to go line by line. Official documentation is good, too.

Feel free to post and @ me or DM me about Python syntax.

wow Zed you are awesome
look the first question someone may ask about a new programming language could be:
How do i insert comments in its code? :slight_smile:
now seriously the basics of informatics is what we are taught in the 1st semester. perhaps that haven’t changed much: algorithm = start, variable, process, cycle, end.
The whole dam semester it is resumed in a file, if i remember correctly: C:\Windows\Scripts.doc maybe i retrieve it later from an instalation cabinet file of Windows 98 and post it here for Not2smart. Then, the 2nd semester it is resumed in your book Learning C the hard way
Zed have a happy new year!

@Not2smart Ive been in your place for about 3 years i have just started to understand python this year with lpthw I still have challenges but with time we shall be good at the language

1 Like

Hello

If it’s any help, I have been self teaching myself a lot of mathematics (to try and change degree), and based on this experience as well as my initial efforts with coding, LPTHW is very good for starting to learn to code.

The first thing is that learning syntax matters a great deal more than I originally thought. In mathematics, much of the difficulty is the extensive amount of notation you need to learn and be comfortable with. You also need to feel comfortable with the syntax (the command line crash course was extremely helpful because it made me feel at ease using the command line.) But feeling at ease = familiarity = taking time.

Second, is that being able to find out for yourself and spotting patterns for yourself is the way to understand the material, active learning! This means being stuck a lot of the time. But by being stuck you will develop good strategies for getting unstuck. In comparison, if you only route learn things, you will not have developed good strategies for getting unstuck when you don’t have a book to guide you.

Third, patience not talent. A lot of being good is learning syntax, and then learning strategies for getting unstuck. Learning strategies for getting unstuck appears like it is talent (as it means you can solve new problems or solve problems faster) and because there isn’t any list you can just learn (unlike syntax). You learn this by doing code! That is what LPTHW has helped me at. Learning to get unstuck, even though this is frustrating :slight_smile:

4 Likes

I like that sentence :+1:

1 Like

That’s spot on! I wouldn’t go so far as to say that talent doesn’t matter, but asking yourself whether you are gifted enough doesn’t help at all when you learn something. If you want it, go ahead and do it. You won’t know what you can do before you’ve learned the ropes anyway.

A while ago I came across this wonderful learning resource for painting/digital arts. That guy is a marvelous teacher. This little video about the appropriate beginner’s mindset applies to learning pretty much anything: https://www.ctrlpaint.com/videos/being-a-beginner

2 Likes
A free service run by Zed A. Shaw for learncodethehardway.org.