One of our most popular books was What to Do After You Hit Return, https://en.wikipedia.org/wiki/What_to_Do_After_You_Hit_Retur.... It remains, to this day, a classic.
Typing in a program from a magazine or book was always a crapshoot unless you really understood and could change the program simply because of the large number of different dialects of BASIC.
Microsoft BASIC eventually became a "standard" of sorts, but that was later.
Which is how lots of us learned to program.
My biggest learning experience was translating a program from Pascal to BASIC; it seemed like a fairly simple translation, but it just wouldn't work. I finally realized the massive difference between GOSUB and a function call. I ended up having to implement my own stack to make things work.
The books I remember from my childhood largely countered this by putting asterisks next to certain lines of a listing:
* For ZX Spectrum change to ...
* For C64 change to ..
I still, vividly, remember the covers of the books I borrowed from my local library. Now available for free here (scroll down to "Usborne 1980s computer books"):
Incidentally, I used to try out some of the BASIC programs in the magazines (usually the shorter ones) on my VIC 20 but I rarely got them to work. Not sure if that was a result of a typo on the printed page, or a typo on my screen, but when I did get something to run, it really felt like an accomplishment.
I also enjoyed being reminded of the incredibly hyperbolic write-ups the magazines used to give the games (you can see the one for the article in the photo). You would read lurid tales of battles against space aliens, then you'd type it in and it would be guiding an ASCII character through a maze with the slow as molasses reponse time that was the hallmark of 8-bit BASIC.
Back in that era I worked for Compute! magazine as an "editorial programmer". People would submit BASIC games to the magazine for some particular 8-bit micro (as in the linked story above), and it was the job of the editorial programmers to port the game to other computers. I did the Apple ][ ports. I got the job (high school, so after school) through a friend who did the C64 ports.