|Murach's Python Programming|
Authors: Michael Urban and Joel Murach
The Murach self-paced approach applied to Python for the first time. How does it fare?
Murach isn't a publisher I was familiar with so I was surprised when I started reading its Python Programming book and found it to be of such high quality. The book is written by Michael Urban and Joel Murach. It is based on Python 3 and is introductory in nature. The book is split into four sections with a total of 18 chapters. Let's spend some time going over the book, chapter-by-chapter.
Chapter 1 is a pretty basic introductory chapter and aims to show you the difference between Python and other languages. It also goes over how to use IDLE (Python's included IDE) and run a "Hello, World" type program. The authors also explain how Python "compiles" the source code to byte code before running it. Finally the chapter gives some tips on how to fix syntax and runtime errors.
Chapter 2 gives an introduction to coding in Python. You will learn about comments, using built-in functions, some of Python's data types, arithmetic expressions, string concatenation and quite a few other topics. There are also two small programs that the authors implement at the end of the chapter using the concepts that you have learned so far.
Chapter 3 digs into control statements. In this case, we are talking about Python's if/elif/else statements as well as how relational and logical operators work in Python. This chapter also covers Python's looping structures (while and for loops), as well as break and continue statements. I didn't see any mention of using the "else" statement with your loops, but I'm not sure I've ever seen that in any book. Programs from the previous chapter are update to demonstrate the new concepts together with a couple of new ones.
Chapter 4 covers the definition and use of functions and modules. This is a fun little chapter where you'll learn about default values, as well as local and global variables. You will also get to create a module, document it and learn how to import it. The authers also mention Python's standard library and describe how to import modules from it. Finally we learn how to plan out a program and then code one up.
Chapter 5 is where we learn about testing and debugging a program. You will learn about the common Python errors and some techniques for testing and debugging your software. As expected, they use IDLE's debugger as well as print() statements to help in debugging one's code. Interestingly we don't learn about exception handling until Chapter 8.
Chapter 6 is about Python's lists and tuple data types. You will learn the basics of working with lists in this chapter and you will write three more programs throughout the chapter. Since tuples are immutable, their coverage is much less, but I think you learn more than enough to use them properly.
Chapter 7 is about how to use Python's to work with files. In this chapter you will learn how to open, create, read and write files. You will also learn about working with binary files and CSV files.
Chapter 8 is the exception handling chapter. It describes how exceptions work, how to handle single and multiple exceptions and how to extract information from the exception object. You will also learn about the finally clause and how to raise an exception yourself. This chapter wraps up the first part of the book.
Section 2 is described as covering "other concepts and skills". It is only five chapters in length and I'll keep this fairly brief. In Chapter 9, we learn about numbers in general. Here are some examples: floating point numbers, formatting numbers, using the locale module, rounding and the decimal module. Chapter 10 is all about strings. We learn a bit about Unicode, slicing, indexes, splitting and joining strings and also create or enhance four programs. The most complex is a Hangman game and is well worth reading about as it splits the functionality of the game into multiple modules. For Chapter 11, the topic is working with dates and times and as well as learning the basics of Python's time and datetime modules in this chapter we create a few programs using them.
In Chapter 12, we finally learn about one of Python's most important data types: The dictionary (or dict). Here we learn how to create a dictionary as well as get, set, add items and delete items. There is also some information on converting a dict to a list and adding more complex values to your dictionaries. As usual, you will create some simple programs in this chapter. This section wraps up in Chapter 13 where we learn about recursion and algorithms. About half the chapter is devoted to learning about recursion works and how it works in Python. The rest covers some common algorithms, such as the factorial, the Fibonacci sequence and the Towers of Hanoi.
Section 3 is about Object Oriented Programming (OOP) in Python and only has three chapters. Basically they cover defining and using classes, inheritance and the design aspect you need to use when doing object-oriented programming. You will create more fun mini-programs in this chapter and learn lots of good information such as how polymorphism works, overriding methods, creating custom exceptions, etc.
The last two chapters are in Section 4. Chapter 17 is an introduction to databases and then dives into using Python's SQLite module, sqlite3. It does not talk about any of the 3rd party modules you can use to connect to enterprise level databases though. By the end of the chapter, you should know how to create a database as well as use SELECT statemtns and INSERT, UPDATE and DELETE statements in SQL.
Chapter 18 is an introduction to creating a GUI program using tkinter. The tkinter module has entire books based on it, so don't expect this chapter to cover all that much. What you will learn is how two write a simple Future Value Calculator application, which is nice. But you won't learn much more than that.
Overall I thought this book was well thought out and executed. The book uses a "paired pages" approach with syntax, guidelines and examples on the right page and extra explanatory information on the left. I'm sure this works well in book form, but in the eBook version it is a bit awkward. In fact, I really can't recommend the eBook that you get direct from Murach. It uses a DRM application called LockLizard Safeguard that you have to download. You get a license file that you will need to run before you can open your book, which is in a .pdc format. The application currently only support Windows and Mac, so for Linux you are just plain out of luck. The application looks like Adobe Reader but it is extremely limited. You cannot highlight or add comments. I used it in Windows and found that if you had the Bookmarks pane in focus, then you could only scroll in that. You would need to click back in the book pane to be able to scroll there.
Apart from the obnoxious eBook client, the book is actually quite good. I feel like it covered the topics well and included some items that you don't always see in introductory Python books, such as the CSV, database and GUI examples. The rest of the book is pretty standard fare for a beginner's book, but the text is clear and the examples are interesting. I really like that you get to write mini-programs in almost all of the chapters and they almost always do something besides just printing out a string.
I believe this is a worthy book for someone who wants to learn Python, but if you already know Python, then this book probably won't have anything of interest for you.
For more recommendations of Python books see Python Books For Beginners and Books for Pythonistas.
|Last Updated ( Friday, 10 February 2017 )|