A Functional Start to Computing with Python: 1st Edition (Paperback) book cover

A Functional Start to Computing with Python

1st Edition

By Ted Herman

Chapman and Hall/CRC

427 pages | 52 B/W Illus.

Purchasing Options:$ = USD
Paperback: 9781466504554
pub: 2013-07-26
SAVE ~$18.99
Hardback: 9781138460829
pub: 2017-07-27
SAVE ~$41.00
eBook (VitalSource) : 9780429195716
pub: 2013-07-26
from $45.98

FREE Standard Shipping!


A Functional Start to Computing with Python enables students to quickly learn computing without having to use loops, variables, and object abstractions at the start. Requiring no prior programming experience, the book draws on Python’s flexible data types and operations as well as its capacity for defining new functions. Along with the specifics of Python, the text covers important concepts of computing, including software engineering motivation, algorithms behind syntax rules, advanced functional programming ideas, and, briefly, finite state machines.

Taking a student-friendly, interactive approach to teach computing, the book addresses more difficult concepts and abstractions later in the text. The author presents ample explanations of data types, operators, and expressions. He also describes comprehensions—the powerful specifications of lists and dictionaries—before introducing loops and variables. This approach helps students better understand assignment syntax and iteration by giving them a mental model of sophisticated data first.

Web Resource

The book’s supplementary website at http://functionalfirstpython.com/ provides many ancillaries, including:

  • Interactive flashcards on Python language elements
  • Links to extra support for each chapter
  • Unit testing and programming exercises
  • An interactive Python stepper tool
  • Chapter-by-chapter points
  • Material for lectures

Table of Contents

Motivation and Background

Inspirations of Computing

Preview of Computing with Python

Spiral Drawing



General Landscape of Computing Languages

Background Skills

Learning a Language

Python Setup



Calculator Mode

Running a Script

Microsoft Windows

Integrated Development Environments (IDEs)

Web Browsers

Functional-Style Python


It’s All 0 and 1

Programming Language Types

Primitives: Numbers, Characters, Booleans

Sequences: Tuples, Lists, Strings, Dictionaries

Type Queries

Yet More Types


Numeric: Float and Integer Arithmetic

Integer Operators

Comparison: Numeric, General, and Type

General Comparison

Type Comparison

Boolean Operators: And, Or, Not

Sequence Operators: Concatenation and Containment

Hidden Operators: Function Application, Indexing, Lookup

Method Calls


Sequential Reduction

Well-Formed Expressions

Parentheses and Priorities

Rules of Evaluation

Names for Values


Basic Print

String Trivia

Functions I

Function Syntax

Head, Body, Parameters, and Arguments

Functions as Commands

Functions II

Parameters: Binding by Position

Arguments by Keyword

Default Parameters by Keyword

Return and None

Using Function Calls and Names

Python’s Built-in Functions

Type Conversion

Namespace Queries

Function Composition

Local Functions

Conditional Logic

Control Flow Using If

Nested If

Levels and Statement Blocks

Else and Elif

Example: Reacting to Type Comparison

Slice, Split, Join

Slices of Sequences, Slices Are Sequences

Splitting Strings

Strings to Words

Joining Lists of Strings

Other Handy String Methods

Method on Method


List Functions: max, min, sum, zip, all, any

List Functions: filter, map, reduce

Streams, Generators, and Iterators

Range Function/Generator

List Comprehensions

Python Generators

Dictionary Comprehensions

Multiline Expressions

Functional Patterns

Tail Recursion

Comprehension Patterns

Creating Structures

Searching and Filtering

Operator, Functools, Itertools


Regular Expressions

Imperative-Style Python

Names for Data



Assignment Syntax

List and Dictionary Item Assignment

Deleting Variables and Items

Where Assignment Goes

Functions and Variables

Scope of Variables

Variables in Functions

Local and Global Scope

Default Global


Mutation and Assignment

Slice Assignment

Mutation in Functions


Mutation and Augmented Assignment

Items as References


Import Statements

Selective Import

Name Spaces

Name Queries

Module Help

Python Standard Library

Module Placement

Learning More

The World of Packages



Repeating Statements

For-Loops with Variables

For-Loops with Variables

Loops on Condition: While Statements

Feedback Control



Comments in Programs

Motivations for Documentation

Cruft, Clarity, and Style

The Pass Statement



Kinds of Bugs

Methods of Debugging

Assertions and Testing

Accumulation Loop Patterns

Block Repetition

The Accumulation Pattern

Going Further

Search Loop Patterns

Sequential Search

Altering Control Flow: Break and Continue

Nested Loops

Recursive Data


Turtle Drawing

Drawing by Shapes

Graphing Data

Input and Output

Console and Keyboard Input

Output Formatting

Reading Files

Writing to Files

Network Programs

Reading a Web Page

The Try and Except Statements

Catching Errors

Catching Network Errors

Making a Web Server

Client and Server

Objects, Classes, and Inheritance

Classes, Instances, Objects, Attributes

Methods Are Functions

The Init Method


Period Syntax

Example: Date/Time Objects

Example: Regular Expressions

Example: HTML Processing

Randomness, Time, and System Modules

The Random Module

The Time Module

The Sys Module

The OS Module

Graphical User Interfaces

GUI Concepts: Widgets, Layout, Actions

Programming with a GUI Framework

The Tk GUI

Frame and Label



Advanced Topics


Python Magic

Platforms and Virtual Machines

Scripts as Commands


Solutions to *-Exercises

Reference Tables


Terminology Review and Exercises appear at the end of each chapter.

About the Originator

About the Series

Chapman & Hall/CRC Textbooks in Computing

Learn more…

Subject Categories

BISAC Subject Codes/Headings:
COMPUTERS / Programming / Games
COMPUTERS / Programming Languages / General
MATHEMATICS / Arithmetic