Python Trying to learn Python; is this book incorrect?

  • Thread starter Thread starter jkoster09
  • Start date Start date
  • Tags Tags
    Book Python
AI Thread Summary
The discussion revolves around learning Python, particularly in the context of using a book titled "The Python Book: The Ultimate Guide to Coding with Python." The user encountered issues with code examples from the book, specifically with the `append` method, which contained a typo that caused errors. The conversation highlights the importance of debugging skills and interpreting error messages. Participants also critique the quality of the book, noting that its availability on torrent sites may indicate it is not a reputable resource. They recommend using free, legal online tutorials from python.org for both Python 2 and 3. Additionally, there is a debate on the value of physical books versus digital resources, with some expressing a preference for the tactile experience of printed materials despite acknowledging the advantages of digital formats.
jkoster09
Messages
15
Reaction score
0
I had a brief stint with Python a year or two ago, and after I learned of the Raspberry Pi I knew I should try to learn again. I purchased this book, knowing full well that the online resources would be sufficient, and some of the code doesn't seem to work.

hello_str = "Hello World"

hello_bool = True

hello_truple = (21, 32)

hello_list = ("Hello,","this","is","a","list")

hello_list = list()
hello_list.append("Hello,")
hello_list.apppend("this")
hello_list.append("is")
hello_list.append("a")
hello_list.append("list")

hello_dict = {"first_name":"*My First Name*",
"last_name":"*My Last Name",
"eye_color":"*My Eye Color*"}
print(hello_list[4])
hello_list[4]+="!"

This is the code copied verbatim from the book. It gets an error at the part with multiple append commands, but even when I comment that out it also hangs on the final line. What am I missing here? If it's any help, the book is simply titled "The Python Book: The ultimate guide to coding with Python". It says it's written for 2.x, but I tried 3 just to be sure. No luck.
 
Technology news on Phys.org
jkoster09 said:
hello_list.apppend("this")
Well this looks like the source of the error. Works fine for me with this fixed.
An important part of coding is learning how to debug - so its good to learn how to interpret the error messages that the interpreter throws at you.
 
Thanks, that helped me fix it. I didn't even notice that it wasn't the first append that it hung up on, or else I might have fixed it myself. Thank you.
 
jkoster09 said:
hello_list.apppend("this")
It looks like they appended an extra 'p' on "append". Was this how it was in the book?
 
Mark44 said:
It looks like they appended an extra 'p' on "append". Was this how it was in the book?
No, that was my fault. I'm going to stick to sleep depravity as my excuse for that obvious slip up.
 
jkoster09 said:
If it's any help, the book is simply titled "The Python Book: The ultimate guide to coding with Python". It says it's written for 2.x, but I tried 3 just to be sure. No luck.
From what I can tell, that is not a good book. How did you find it? Just because there are lots of free (but illegal) downloads for that book does not mean it is good. From what I've seen, if the first google page on searching the title of a book comprises almost entirely links to various torrent sites, run away. It's not a good book.

Python is an open source language, and as such, you can find lots and lots of free (and legal) tutorials on how to program in python. As a starter, I suggest you go to the source, python.org. For python2, look to https://docs.python.org/2/tutorial, and for python3, https://docs.python.org/3/tutorial. They're both free, they're both very good, and they're both legal.
 
I bought it at a local bookstore, so it is completely legal. And I recognize that there are many free and probably better online resources, but I have a need for the physical thing that I can't explain. I'll use it to some extent, but I'll almost certainly resort to these online sources soon, just not yet.
 
jkoster09 said:
the book is simply titled "The Python Book: The ultimate guide to coding with Python".
Who's the author? I can't find anything with that title on amazon.com.
 
https://www.imagineshop.co.uk/the-python-book.html
 
Last edited by a moderator:
  • #10
Aha, it's a "bookazine", not a "real book." I've seen this sort of thing in the magazine section of my "local" Barnes & Noble. They may even carry Imagine Publishing's bookazines; I've seen other UK publications there.
 
  • #11
jkoster09 said:
And I recognize that there are many free and probably better online resources, but I have a need for the physical thing that I can't explain.

That is something I totally understand. To me, there's just something magical about words on paper that words on a computer screen cannot yet replicate. If you wish, you can highlight those words on paper with a yellow marker in the blink of an eye. You can do that with a computerized book,but not in a blink of an eye. You can flip from page 1 to page 101 in the blink of an eye with a book on paper; good luck with that with a computerized book.

Done wrongly, that computer-based facsimile is just that, a facsimile. Done correctly, a computer-based version of a book or journal paper is anything but a facsimile of a paper copy. Good luck searching a paper copy for a keyword. It's cinch with a properly done computerized version. That's but one of the magical features of computerized papers.
 
Back
Top