It is hard to tell, but it looks like Python 3 is in use, and I suspect the book is requiring Python 2. If you can re-run the program with Python 2, you may find you have far fewer errors (if any). If you do have a new error, you can then ask a new Stack Overflow question about that. Remember to be precise about the problem, and to include the error message(s) you get.
solved Is there anything wrong with the Python code itself? [closed]