My Cart (0)

Customer Service 1-800-221-5528

Python programming book  - Murach

Murach’s Python Programming

by Michael Urban and Joel Murach
18 chapters, 576 pages, 223 illustrations
Published December 2016
ISBN 978-1-890774-97-4
Print: $57.50
eBook: $52.50
Print + eBook: $70.00

Covers Python 3

Python is one of today’s fastest-growing languages. Its simple syntax makes it relatively easy to learn, and its diverse uses…from web and game programming to data analysis and data mining to scientific computing, artificial intelligence, and more!...are fueling its popularity. So we had to answer the clamor for a Murach book on Python. Now, we believe it provides the fastest, easiest, yet most professional way to learn Python that you can find, whether you’re a beginning programmer or have years of experience.

College Instructors

Go to our instructor’s site to learn more about this book and its instructor’s materials.

 

This is by far the best Python tutorial I have come across. Tried Udemy, Udacity, some other video and printed tutorials, but didn’t get the feel of it. Murach's side-by-side lecture & example really works for me. And the sample codes and exercises are valuable tutorials that any newbie will want to keep as reference materials. Really effective training style.”

  • About this Book
  • Table of Contents
  • FREE Downloads
  • Book FAQs
  • Corrections
  • Reviews

Who this book is for

This book is for anyone who wants to learn Python. If Python is your first programming language, it helps you master all the skills and concepts you need to program in any modern language, as you learn Python itself. If you’re an experienced programmer who wants to add Python to your resume, it will help you learn Python faster and better than you’ve ever learned a language before. And either way, once you’ve used it for self-training, it becomes your ideal on-the-job reference.

What this book does

To make this book as effective as possible, the content is divided into four sections:

  • Section 1 presents an eight-chapter course in Python that gets you off to a great start. This section works for both beginners and experienced programmers because it lets you set your own pace. If you’re a beginner, you’ll move slowly and do all the exercises. If you have experience, you’ll move more quickly, skimming through material you already know to focus on skills that are new to you or that you’ve never mastered. At the end, you’ll have a strong set of the base skills that you’ll use in any Python program.
  • Section 2 builds on the subset in section 1 to present the additional skills that every Python programmer should master. Here, then, you’ll learn more about working with numbers and strings than what was presented in section 1. And you’ll gain new skills for working with dates and times, dictionaries, recursion, and algorithms.
  • Section 3 consists of three chapters that show how to design and develop object-oriented programs. OOP is critical in today’s world, and if you’re new to the concepts or you’ve always been somewhat mystified by them, Python’s syntax combined with our presentation will make it all clear.
  • The focus of section 4 is to show you how all of the skills that you’ve learned in the first three sections are applied to real-world programs. First, chapter 17 shows you how to use Python for database programming, a must in businesses large and small. Then, chapter 18 shows you how to use Python to develop programs with graphical user interfaces (GUIs).

Why you’ll learn faster and better with this book

Like all our books, this one has features that you won’t find in competing books. That’s why you’ll learn faster and better with our book than with any other. Here are a few of those features.

  • As you page through this book, you’ll see that all of the information is presented in “paired pages,” with the essential syntax, guidelines, and examples on the right page and the perspective and extra explanation on the left page. This helps you learn faster by reading less...and this is the ideal reference format when you need to refresh your memory about how to do something.
  • To show you how Python works, this book presents 45 complete programs that build from the simple to the complex. We believe that studying the code for complete programs is critical to the learning process... and yet you won’t find programs like ours, that tie all your newfound skills together, in other Python books.
  • Of course, this book also presents hundreds of short examples, so it’s easy to find an example that shows what you want to do. Even better, our paired pages make it easier to find the example that you’re looking for than it is with traditional books that embed the examples in the text.
  • Like all our books, this one has exercises at the end of each chapter that give you hands-on experience in practicing what you’ve learned. They also encourage you to experiment and to apply what you’ve learned in new ways…just as you’ll have to do on the job. They start from partial programs that provide the boilerplate code, giving you more practice in less time as you focus on the skills you’ve just learned. And they tie a number of skills together instead of having you apply one skill per exercise…an approach that’s much more realistic and satisfying.

What software you need for this book

To develop Python programs, you just need to download and install Python. It includes an integrated development environment (IDE) called IDLE that you can use for coding, testing, and debugging your programs. Chapter 1 shows how to use IDLE, and appendixes A and B show how to install Python and IDLE on Windows and Mac OS X systems.

If you’re going to develop programs that use a SQLite database as shown in chapter 17, you also need to download and install DB Browser for SQLite. Appendixes A and B also provide the instructions for doing that.

What people say about this book

“This is now my third text book for Python, and it is the ONLY one that has made me feel comfortable solving and reading problems or code respectively. The paired pages approach is fantastic, and it is probably the only reason that makes learning the syntax, rules, and conventions understandable for me. I really do appreciate the authors’ ability to bring the concepts to life with this approach.”

“The material in the book itself is worth 6 stars [out of 5]. It's second to none in its quality. I wouldn't suggest learning languages from anything but a Murach book.”

“[Take a look at the contents] and see where they put testing/debug: Chapter 5. I love the placement! Folks going through the book get Python installed, receive positive returns with some basic code, and then take a breather with testing/debugging before more complex things come their way.”

“Murach's Rock: Murach's usual excellent coverage with examples that are actually practical.”

“This is not only a book to learn Python but also a well structured guide to refer to whenever I face a Python problem. What I really like is that it is very well-organized and easy to follow. It covers the perfect amount of description and it does not make you bored by providing unnecessary details.”

“Good introduction to the Python language. I find it far more helpful than the others I am also using.”

“Love this book so far. Very informative in helping me learn coding in Python.”

“I've been a fan of Murach's approach to teaching programming concepts and practices for many years, and now they've finally published a book on Python, and they've done a wonderful job…. The book's high points are the chapters on debugging and testing, and the discussion of some of the features of Python 3.x. The fact that the authors spend a healthy portion of the book illustrating OOP is very much appreciated.”

View the table of contents for this book in a PDF: Table of Contents (PDF)

Click on any chapter title to display or hide its content.

Section 1 Essential concepts and skills

Chapter 1 An introduction to Python programming

Introduction to Python

Why Python works so well as your first programming language

Three types of Python applications

The source code for a console application

How Python compiles and runs source code

How disk storage and main memory work together

How to use IDLE to develop programs

How to use the interactive shell

How to work with source files

How to compile and run a program

How to fix syntax and runtime errors

Chapter 2 How to write your first programs

Basic coding skills

How to code statements

How to code comments

How to use functions

How to work with data types and variables

How to assign values to variables

How to name variables

How to work with numeric data

How to code arithmetic expressions

How to use arithmetic expressions in assignment statements

How to use the interactive shell for testing numeric operations

How to work with string data

How to assign strings to variables

How to join strings

How to include special characters in strings

How to use the interactive shell for testing string operations

How to use five of the Python functions

How to use the print() function

How to use the input() function

How to use the int(), float(), and round() functions

How to chain functions

Two illustrative programs

The Miles Per Gallon program

The Test Scores program

Chapter 3 How to code control statements

How to code Boolean expressions

How to use the relational operators

How to use the logical operators

How to compare strings

How to code the selection structure

How to code if statements

More examples of if statements

How to code nested if statements

How to use pseudocode to plan if statements

Two illustrative programs

The Miles Per Gallon program

The Invoice program

How to use the iteration structure

How to code while statements

How to code for statements

How to code break and continue statements

More examples of loops

How to use pseudocode to plan a program

Two illustrative programs

The Test Scores program

The Future Value program

Chapter 4 How to define and use functions and modules

How to define and use functions

How to define and call a function

How to define and call a main() function

The Future Value program with functions

More skills for defining and using functions

How to use default values for arguments

How to use named arguments

When and how to use local and global variables

How to create and use modules

How to create a module

How to document a module

How to import a module

The Convert Temperatures program

How to use standard modules

How to use the random module

The Guess the Number game

How to plan the functions of a program

How to use a hierarchy chart

The hierarchy chart for the Pig Dice game

The Pig Dice game with global variables

The Pig Dice game with local variables

Chapter 5 How to test and debug a program

An introduction to testing and debugging

The three types of errors that can occur

Common Python errors

Four techniques for testing and debugging

How to plan the test runs

A simple way to trace code execution

How to use top-down coding and testing to simplify debugging

How to use the IDLE shell to test functions

How to use the IDLE debugger

How to set and remove breakpoints

How to step through the code

How to view the stack

Chapter 6 How to work with lists and tuples

Basic skills for working with lists

How to create a list

How to get and set items

How to add and remove items

How to process the items in a list

How lists are passed to functions

The Movie List program

How to work with a list of lists

How to create a list of lists

How to process the items in a list of lists

The Movie List 2D program

More skills for working with lists

How to count, reverse, and sort the items in a list

How to use other functions with lists

How to copy, slice, and concatenate lists

How to work with tuples

How to create a tuple

How to get items from a tuple

The Number Crunching program

Chapter 7 How to work with file I/O

An introduction to file I/O

How file I/O works

How to open and close a file

How to use text files

How to write a text file

How to read a text file

How to work with a list in a text file

The Movie List 1.0 program

How to use CSV files

How to write a CSV file

How to read a CSV file

How to modify the CSV format

The Movie List 2.0 program

How to use binary files

How to work with a binary file

The Movie List 3.0 program

Chapter 8 How to handle exceptions

How to handle a single exception

How exceptions work

How to use a try statement to handle one type of exception

The Total Calculator program

How to handle multiple exceptions

How to use a try statement to handle multiple exceptions

How to get the information from an exception object

The Movie List 2.0 program

Two more skills

How to use a finally clause

How to raise an exception

Section 2 Other concepts and skills

Chapter 9 How to work with numbers

Basic skills for working with numbers

How floating-point numbers work

How to use the math module

How to format numbers

How to use the format() method of a string

How to use the locale module

How to fix rounding errors

How to work with decimal numbers

How to use the decimal module

The Invoice program with decimal numbers

The Future Value program with decimal numbers

Chapter 10 How to work with strings

Basic skills for working with strings

Unicode, indexes, slicing, duplicating, and multiline strings

How to search a string

How to loop through the characters in a string

How to use basic string methods

How to find and replace parts of a string

The Create Account program

How to split and join strings

How to split a string into a list of strings

How to join strings

The Movie List 2D program

The Word Counter program

The Hangman game

The user interface

The hierarchy chart

The wordlist module

The hangman module

Chapter 11 How to work with dates and times

How to get started with dates and times

How to create date, time, and datetime objects

How to create datetime objects by parsing strings

How to format dates and times

How to work with spans of time

The Invoice Due Date program

The Timer program

More skills for working with dates and times

How to get date and time parts

How to compare date/time objects

The Hotel Reservation program

Chapter 12 How to work with dictionaries

How to get started with dictionaries

How to create a dictionary

How to get, set, and add items

How to delete items

How to loop through keys and values

How to convert between dictionaries and lists

The Country Code program

The Word Counter program

More skills for working with dictionaries

How to use dictionaries with complex objects as values

The Book Catalog program

Chapter 13 How to work with recursion and algorithms

An introduction to recursion

How recursion works in Python

How to use recursion to add a range of numbers

Some common recursive algorithms

How to compute the factorial of a number

How to compute a Fibonacci series

An algorithm for solving the Towers of Hanoi puzzle

The code for solving the Towers of Hanoi puzzle

Section 3 Object-oriented programming

Chapter 14 How to define and use your own classes

An introduction to classes and objects

Two UML diagrams for the Product class

Code that defines a Product class

Code that uses a Product class

How to create and use objects

How to define a class

How to code a constructor and attributes

How to code methods

The Product Viewer 1.0 program

How work with object composition

How object composition works

The Die and Dice classes

The Dice Roller 1.0 program

How to work with encapsulation

How object encapsulation works

How to hide attributes

How to access hidden attributes with methods

How to access hidden attributes with properties

The Die and Dice classes with encapsulation

The Product class with some encapsulation

The Pig Dice game

The console

The code

Chapter 15 How to work with inheritance

How to work with inheritance

How inheritance works

How to define a subclass

How polymorphism works

How to check an object’s type

The Product Viewer 2.0 program

The objects module

The user interface and product_viewer module

How to override object methods

How to define a string representation for an object

How to define an iterator for an object

The Die and Dice classes

Two more skills for the road

How to work with custom exceptions

When to use inheritance

Chapter 16 How to design an object-oriented program

Techniques for object-oriented design

Five steps for designing an object-oriented program

How to identify the data attributes

How to subdivide the data attributes

How to identify the classes

How to identify the methods

How the three-tier architecture works

The Shopping Cart program

The business tier

The database tier

The presentation tier

Section 4 Database and GUI programming

Chapter 17 How to work with a database

An introduction to relational databases

How a database table is organized

How the tables in a database are related

How the columns in a table are defined

How to use the SQL statements for data manipulation

How to select data from a single table

How to select data from multiple tables

How to insert, update, and delete rows

How to use SQLite Manager to work with a database

How to connect to a SQLite database

How to execute SQL statements

How to use Python to work with a database

How to connect to a SQLite database

How to execute SELECT statements

How to get the rows in a result set

How to execute INSERT, UPDATE, and DELETE statements

How to test the database code

How to handle database exceptions

The Movie List program

The user interface

The business tier

The database tier

The presentation tier

Chapter 18 How to build a GUI program

How to create a GUI that handles an event

How to display a root window

How to work with frames and buttons

How to handle a button click event

More skills for working with components

How to work with labels and text entry fields

How to lay out components in a grid

How to code a class that defines a frame

The Future Value program

The business module

The ui module

Appendix A How to set up Windows for this book

How to install the source code for this book

How to install Python and IDLE

How to install Firefox and SQLite Manager

How to verify that the database is installed correctly

Appendix B How to set up Mac OS X for this book

How to install the source code for this book

How to install Python and IDLE

How to verify that Python and IDLE are working correctly

How to install Firefox and SQLite Manager

How to verify that the database is installed correctly

Free chapters

To get a better idea of how well this book works, you can download its first two chapters in PDF format. As you will see, these chapters work well for programming novices as well as experienced programmers. If you’re a beginner, these chapters will help you discover whether you like programming.

Chapter 1: An introduction to Python programming

This chapter is a quick introduction to Python programming and the IDLE interactive environment that’s used for developing Python programs.

Chapter 2: How to write your first programs

This chapter presents a starting subset of Python skills that lets you write your first programs. And we’re not talking about a few lines of “Hello World” code, but complete programs that get input, process it, and display output. This chapter works great for beginners, and if you have some programming experience, you’ll speed through it.

Chapter 1 PDF (1.0MB) Download Now

Chapter 2 PDF (0.7MB) Download Now

Book programs and exercises

This download includes:

  • The source code for the programs in the book
  • The starting source code for the exercises in the book
  • The solutions to the exercises in the book

Appendix A for Windows and appendix B for Mac OS X show how to install and use these files.

Exe file for Windows (0.4MB) Download Now

Zip file for any system (0.3MB) Download Now

To view the "Frequently Asked Questions" for this book in a PDF, just click on this link: View the questions

Then, if you have any questions that aren't answered here, please email us. Thanks!

To view the corrections for this book in a PDF, just click on this link: View the corrections

Then, if you find any other errors, please email us so we can correct them in the next printing of the book. Thank you!

Kristin Smith

Friday, 19 March 2021

I am not only new to code to start with, but also rather unsavvy with computers, and I was able to understand and make progress in my skills with this book - to put it short, if I can do it anyone should be able to! I like the side by side pages, that's something I haven't seen in any other book and it helped me a lot to read the theory and view the 'cleaned up' side at the same time. It also allows me to go back and review what I need to quickly instead of having to scan a wall of text to find one small piece of relevant information. I would highly recommend this to anyone just starting out, it walks you through every little thing you need, gives you opportunities to explore and play with the code, and is overall concise and well organized.

maryam mn

Wednesday, 31 May 2017

There is a one page, or sometimes even less than one page explanation, which is completely to the point and gives you what you need to know. It covers the perfect amount of description and it does not make you bored by providing unnecessary details. There is of course the syntax introduction as well, which is followed by some key points in form of bullets about the key points you need to consider when using the syntax. Overall, the structure of the book makes it very easy to follow and makes the learning process so much faster.
The book provides graphics and summarization whenever there is a need for more detailed explanation.

Lonnie Hailey

Wednesday, 15 February 2017

So far I'm loving it.

More reviews

To leave a review, please log in to your account.     Log In Here

Our Ironclad Guarantee

You must be satisfied. Try our print books for 30 days or our eBooks for 14 days. If they aren't the best you've ever used, you can return the books or cancel the eBooks for a prompt refund. No questions asked!

Contact Murach Books

For orders and customer service:

1-800-221-5528

Weekdays, 8 to 4 Pacific Time

College Instructors

If you're a college instructor who would like to consider a book for a course, please visit our website for instructors to learn how to get a complimentary review copy and the full set of instructional materials.