A Concise Introduction to Programming In Python

Author: Mark J. Johnson
Publisher: Chapman & Hall/CRC Press
Pages: 217
ISBN: 978-1439896945
Aimed at: Complete beginners in classroom setting
Rating: 4
Pros: Comprehensive introduction to language and concepts
Cons: No answers
Reviewed by: Sue Gee

Intended as a first course in Computer Science, is this also a good book for the independent learner?

Python has become a popular choice as a language to teach to complete beginners. This slim book sets out to teach not just the basics of Python but also the fundamental ideas that need to be covered at the beginning of the computer science curriculum.

Author Mark Johnson is a professor of computer science and mathematics at Central College in Pella, Iowa and this book has short chapters each designed to be covered in a single class. The book uses Python 3.2 and its programs are available on the College's website.

 

Banner

 

The book is divided into three parts with Part I being Foundations. Chapter 1 has the title "Computer Systems and Software" and there's a single Python listing after a short discussion of the CPU and RAM, machine languages and compilers and interpreters. To experiment with the program you are expected to use IDLE .

Chapter 2 gets down to "Python Program Components" introducing variables, reserved keywords, the idea that a program consists of a sequence of statements and the importance of the correct syntax. We learn about assignments statements,  print statements and import statements. Three data types - strings, integers and floats - and are introduced, as are numeric expressions, arithmetic operations and comments. There are exercises at the end of every chapter and to make the best of this book you do need to work through them. There are twelve items to tackle after Chapter 2, many of them involving modifying the two listings already presented. No answers are supplied - which may be a problem for the independent learner.

Chapter 3 is on Functions - defining and calling them and using return. It also introduces the idea of local variables and emphasises the importance of testing  including testing boundary cases. The listing in Chapter 3, which you work with for the exercises is a mathematical one. It uses the sqrt() function from the math module to implement hypot(), which is also in the math module.

For loops are introduced in Chapter 4 and its example listing is for computing the harmonic sum. The range function and the idea of accumulation loops are discussed. Assignment shorthands, x+=y being equivalent to x=x+y, are are also introduced in this chapter. Is this a bit advanced at this stage?

There's no Python in the next chapter - instead there's a brief discussion of how data is stored in a computer. We encounter bits and bytes, binary numbers and hexadecimal, signed and unsigned integers and how memory sizes are expressed in powers of 2.

Chapter 6 is on selection statements with If statements and Boolean expressions. The example uses turtle graphics and the Python turtle module. Then comes a discursive chapter on "Algorithm  Design and Debugging" which introduces using pseudo code and then in Chapter 8 we encounter while loops. After this comes a project for implementing Newton's Method, an iterative technique for computing roots of mathematical functions - here the objective is to compute a square root.

Chapter 9 "Computer Memory: Floats" is another pythonless chapter and is about binary fractions. Chapter 10 "Simulation" considers the mathematical problem of finding the area under a curve and introduces Monte Carlo integration and random numbers. A project on linked to this chapter brings this first part of the book to a close.

Part II: Collection and Files starts with Chapter 11 on "Strings" in which we experiment with Pig Latin and encounter indexing, slicing and concatenation followed up in the next chapter with more string operations. Chapter 13 introduces ASCII code.

Lists are introduced next with an examination of how they are and are not like strings. Various list methods are introduced and we also encounter the idea of objects and object methods - working towards looking at Python as an object-oriented language in Part III.

Files follow on a bit later, introducing the with statement and several file methods and then we return to string methods and learn about finding and modifying strings. Towards the end of Part II there's are chapters on "Mutable and Immutable Objects" and "Dictionaries", which are themselves objects..

This section of of the book has eight projects on a diverse range of topics - including calculating the check digit for a 10-digit ISBN number, modelling heat diffusion, a Hangman game, and Shannon entropy, a topic in information theory. There's also one on ELIZA in which you are asked to research the Turing Test. While these would make good classroom or homework projects as they don't include code listings, and not all have pseudo code, they might be too daunting for the individual beginner.

The final part of the book has the title "Selected Topics" It opens with chapters on sound synthesis, sound manipulation, image synthesis and image manipulation. which don't introduce new programming concepts, concentrating instead on the physics of sound and issues of computer memory and RGB color.

That changes when we get to Chapter 23, on "Writing Classes", where object-oriented terminology is introduced. The next two chapters are on how to use classes in combination. List comprehensions, the map function and inheritance are introduced along the way.

Chapter 26 lists and characterizes  four programming paradigms that Python supports: imperative, procedural, object-oriented  and functional programming, which is the main subject of the chapter. After discussing iterators and iterables, ideas initially introduced in Part I, it moves on to Lambda expressions and recursion. Chapter 27 is on Parallel Programming for multiprocessing

The final chapter is on Graphical User Interfaces and introduces the tkinter module (Tk),  one of the standard Python libraries for developing graphical applications. It also discusses event-driven programming.

This book presents material in a logical order and if you stay the course and complete the exercises you will get a grounding in computer science and become familiar with Python. You'll also absorb some, perhaps too much, math and physics along the way, 

The book isn't really aimed at the individual student, and as a title in the Textbook in Computing Series, doesn't claim to be. The real audience isn't even students - it is other instructors. There's enough in this text for them to pick and choose the projects and exercises they ask students to complete and for this group the book would fulfil its promise to be a concise introduction.


Banner


Mathematics for Machine Learning

Authors: Marc Peter Deisenroth, Aldo Faisal and Cheng Soon Ong
Publisher: Cambridge University Press
Pages: 398
ISBN: 978-1108455145
Print: 110845514X
Kindle: B083M7DBP6
Audience: Developers interested in machine learning
Rating: 3.5
Reviewer: Mike James
Lots of people need to learn the math behind mach [ ... ]



Practices of the Python Pro

Author: Dane Hillard
Publisher: Manning
Date: January 2020
Pages: 248
ISBN: 978-1617296086
Print: 1617296082
Audience: Python developers
Rating: 3
Reviewer: Mike James
I want to be a Python Pro....


More Reviews

Last Updated ( Monday, 19 March 2012 )