0% found this document useful (0 votes)
36 views69 pages

Fundamentals of Python: First Programs, 2nd Edition Kenneth A. Lambert instant download

The document provides information about the 'Fundamentals of Python: First Programs, 2nd Edition' by Kenneth A. Lambert, including links for downloading the ebook and related titles. It outlines the structure of the book, which covers essential programming concepts, Python syntax, and software development. Additionally, it includes a copyright notice and details about the publisher, Cengage Learning.

Uploaded by

umberfrias7n
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views69 pages

Fundamentals of Python: First Programs, 2nd Edition Kenneth A. Lambert instant download

The document provides information about the 'Fundamentals of Python: First Programs, 2nd Edition' by Kenneth A. Lambert, including links for downloading the ebook and related titles. It outlines the structure of the book, which covers essential programming concepts, Python syntax, and software development. Additionally, it includes a copyright notice and details about the publisher, Cengage Learning.

Uploaded by

umberfrias7n
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

Fundamentals of Python: First Programs, 2nd

Edition Kenneth A. Lambert pdf download

https://textbookfull.com/product/fundamentals-of-python-first-
programs-2nd-edition-kenneth-a-lambert/

Download more ebook from https://textbookfull.com


We believe these products will be a great fit for you. Click
the link to download now, or visit textbookfull.com
to discover even more!

Fundamentals Of Python: Data Structures 2nd Edition


Kenneth A. Lambert

https://textbookfull.com/product/fundamentals-of-python-data-
structures-2nd-edition-kenneth-a-lambert/

Biota Grow 2C gather 2C cook Loucas

https://textbookfull.com/product/biota-grow-2c-gather-2c-cook-
loucas/

Building Python Programs 1st Edition Stuart Reges

https://textbookfull.com/product/building-python-programs-1st-
edition-stuart-reges/

Fundamentals of Structural Analysis Kenneth M. Leet

https://textbookfull.com/product/fundamentals-of-structural-
analysis-kenneth-m-leet/
Head First Python A Brain Friendly Guide 2nd Edition
Paul Barry

https://textbookfull.com/product/head-first-python-a-brain-
friendly-guide-2nd-edition-paul-barry/

Fundamentals of Music Processing: Using Python and


Jupyter Notebooks 2nd Edition Meinard Müller

https://textbookfull.com/product/fundamentals-of-music-
processing-using-python-and-jupyter-notebooks-2nd-edition-
meinard-muller/

Ten Lessons In Introductory Sociology 2nd Edition


Kenneth A. Gould

https://textbookfull.com/product/ten-lessons-in-introductory-
sociology-2nd-edition-kenneth-a-gould/

Essentials of Anatomy & Physiology, 2nd Edition Kenneth


S. Saladin

https://textbookfull.com/product/essentials-of-anatomy-
physiology-2nd-edition-kenneth-s-saladin/

Learn Python Programming A beginner s guide to learning


the fundamentals of Python language to write efficient
high quality code Romano

https://textbookfull.com/product/learn-python-programming-a-
beginner-s-guide-to-learning-the-fundamentals-of-python-language-
to-write-efficient-high-quality-code-romano/
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
second Edition

Fundamentals of Python:
First Programs

Kenneth A. Lambert

Martin Osborne,
Contributing Author

Australia • Brazil • Mexico • Singapore • United Kingdom • United States

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
This is an electronic version of the print textbook. Due to electronic rights restrictions,
some third party content may be suppressed. Editorial review has deemed that any suppressed
content does not materially affect the overall learning experience. The publisher reserves the right
to remove content from this title at any time if subsequent rights restrictions require it. For
valuable information on pricing, previous editions, changes to current editions, and alternate
formats, please visit www.cengage.com/highered to search by ISBN#, author, title, or keyword for
materials in your areas of interest.

Important Notice: Media content referenced within the product description or the product
text may not be available in the eBook version.

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Fundamentals of Python: © 2019, 2012 Cengage
First Programs, Second Edition
ALL RIGHTS RESERVED. No part of this work covered by the copy-
­Kenneth A. Lambert
right herein may be reproduced or distributed in any form or by
any means, except as permitted by U.S. copyright law, without the
SVP, GM Skills: Jonathan Lau prior written permission of the copyright owner.

Product Team Manager: Kristin Unless otherwise noted all tables/figures exhibits are © 2019 ­Cengage®
McNary

Associate Product Manager: Kate


For product information and technology assistance, contact us
Mason
at Cengage Customer & Sales Support, 1-800-354-9706
Executive Director of Development:
Marah Bellegarde For permission to use material from this text or product, submit
all requests online at www.cengage.com/permissions.
Senior Content Development Further permissions questions can be e-mailed to
­Manager: Leigh Hefferon [email protected]

Content Development Manager: Jill


Gallagher
Library of Congress Control Number: 2017952738
Senior Content Developer: Natalie
Pashoukos
Softbound ISBN: 978-1-337-56009-2
Product Assistant: Jake Toth Loose Leaf ISBN: 978-1-337-69934-1

Marketing Director: Michele McTighe Cengage


20 Channel Center Street
Marketing Manager: Stephanie Boston, MA, 02210
Albracht
USA
Senior Content Project Manager:
Cengage is a leading provider of customized learning solutions with
Jennifer Feltri-George
employees residing in nearly 40 different countries and sales in more
Senior Designer/Art Director: Diana than 125 countries around the world. Find your local representative
Graham at www.cengage.com.

Cover image: Digital_Art/­ Cengage products are represented in Canada by Nelson Education, Ltd.
Shutterstock.com To learn more about Cengage, visit www.cengage.com.
Production Service/Composition: Purchase any of our products at your local college store or at our
SPi Global ­preferred online store www.cengagebrain.com.

Notice to the Reader

Publisher does not warrant or guarantee any of the products described herein or perform any independent analysis
in connection with any of the product information contained herein. Publisher does not assume, and expressly
disclaims, any obligation to obtain and include information other than that provided to it by the manufacturer. The
reader is expressly warned to consider and adopt all safety precautions that might be indicated by the activities
described herein and to avoid all potential hazards. By following the instructions contained herein, the reader willingly
assumes all risks in connection with such instructions. The publisher makes no representations or warranties of any
kind, including but not limited to, the warranties of fitness for particular purpose or merchantability, nor are any
such representations implied with respect to the material set forth herein, and the publisher takes no responsibility
with respect to such material. The publisher shall not be liable for any special, consequential, or exemplary damages
resulting, in whole or part, from the readers’ use of, or reliance upon, this material.

Printed in the United States of America


Print Number: 01 Print Year: 2017
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents
iii

Pref ace ������������������������������������������������ xiii

CHAPTER 1 I n t ro du ct io n����������������������������������������������� 1
Two Fundamental Ideas of Computer Science: ­
Algorithms and Information Processing ������������������������������ 2
Algorithms ������������������������������������������������������������������� 2
Information Processing��������������������������������������������������� 4
Exercises ������������������������������������������������������������������������ 5
The Structure of a Modern Computer System������������������������ 6
Computer Hardware ������������������������������������������������������� 6
Computer Software ������������������������������������������������������� 7
Exercises ������������������������������������������������������������������������ 9
A Not-So-Brief History of Computing Systems������������������������ 9
Before Electronic Digital Computers��������������������������������11
The First Electronic Digital Computers (1940–1950) ���������13
The First Programming Languages (1950–1965) ��������������14
Integrated Circuits, Interaction,
and Timesharing (1965–1975)��������������������������������������16
Personal Computing and Networks (1975–1990) ��������������17
Consultation, Communication,
and E-Commerce (1990–2000)��������������������������������������19
Mobile Applications and Ubiquitous
Computing (2000–present) ������������������������������������������21
Getting Started with Python Programming ���������������������������22
Running Code in the Interactive Shell ������������������������������22
Input, Processing, and Output�����������������������������������������24
Editing, Saving, and Running a Script ������������������������������27
Behind the Scenes: How Python Works�����������������������������28
Exercises �����������������������������������������������������������������������29
Detecting and Correcting Syntax Errors������������������������������29
Exercises �����������������������������������������������������������������������30
Suggestions for Further Reading ���������������������������������������30
Summary �����������������������������������������������������������������������31

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
contents

Review Questions ������������������������������������������������������������32


Projects��������������������������������������������������������������������������33

CHAPTER 2 S o f t w are D
­ evelo pment, Data Ty pes,
iv an d Expres s io n s��������������������������������������� 34
The Software Development Process �����������������������������������35
Exercises �����������������������������������������������������������������������37
Case Study: Income Tax Calculator ������������������������������������38
Strings, Assignment, and Comments�����������������������������������41
Data Types ������������������������������������������������������������������41
String Literals��������������������������������������������������������������42
Escape Sequences��������������������������������������������������������43
String Concatenation�����������������������������������������������������43
Variables and the Assignment Statement��������������������������44
Program Comments and Docstrings ��������������������������������45
Exercises �����������������������������������������������������������������������46
Numeric Data Types and Character Sets �����������������������������47
Integers�����������������������������������������������������������������������47
Floating-Point Numbers��������������������������������������������������47
Character Sets ������������������������������������������������������������48
Exercises �����������������������������������������������������������������������49
Expressions��������������������������������������������������������������������49
Arithmetic Expressions��������������������������������������������������50
Mixed-Mode Arithmetic and Type Conversions��������������������52
Exercises �����������������������������������������������������������������������53
Using Functions and Modules ��������������������������������������������54
Calling Functions: Arguments and Return Values ���������������54
The math Module ���������������������������������������������������������55
The Main Module�����������������������������������������������������������56
Program Format and Structure ���������������������������������������57
Running a Script from a Terminal Command Prompt�����������57
Exercises �����������������������������������������������������������������������59
Summary �����������������������������������������������������������������������59
Review Questions ������������������������������������������������������������61
Projects��������������������������������������������������������������������������62

CHAPTER 3 Lo o ps an d S elec ti on S tatements������������������ 64


Definite Iteration: The for Loop�����������������������������������������65
Executing a Statement a Given Number of Times ��������������65
Count-Controlled Loops��������������������������������������������������66
Augmented Assignment��������������������������������������������������67
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
contents

Loop Errors: Off-by-One Error�����������������������������������������68


Traversing the Contents of a Data Sequence ��������������������68
Specifying the Steps in the Range�����������������������������������69
Loops That Count Down ������������������������������������������������69
Exercises �����������������������������������������������������������������������70
Formatting Text for Output������������������������������������������������70 v
Exercises �����������������������������������������������������������������������72
Case Study: An Investment Report��������������������������������������73
Selection: if and if-else Statements ������������������������������77
The Boolean Type, Comparisons, and Boolean
Expressions ���������������������������������������������������������������77
if-else Statements�����������������������������������������������������78
One-Way Selection Statements ���������������������������������������79
Multi-Way if Statements �����������������������������������������������80
Logical Operators and Compound Boolean Expressions �����82
Short-Circuit Evaluation��������������������������������������������������84
Testing Selection Statements �����������������������������������������84
Exercises �����������������������������������������������������������������������85
Conditional Iteration: The while Loop ��������������������������������86
The Structure and Behavior of a while Loop��������������������86
Count Control with a while Loop������������������������������������87
The while True Loop and the break Statement���������������88
Random Numbers ���������������������������������������������������������90
Loop Logic, Errors, and Testing��������������������������������������91
Exercises �����������������������������������������������������������������������92
Case Study: Approximating Square Roots ���������������������������92
Summary �����������������������������������������������������������������������96
Review Questions ������������������������������������������������������������97
Projects��������������������������������������������������������������������������99

CHAPTER 4 S t r in g s an d Text Fi l es ����������������������������� 102


Accessing Characters and Substrings in Strings ��������������� 103
The Structure of Strings ��������������������������������������������� 103
The Subscript Operator����������������������������������������������� 104
Slicing for Substrings ������������������������������������������������ 105
Testing for a Substring with the in Operator ����������������� 105
Exercises �������������������������������������������������������������������� 106
Data Encryption ����������������������������������������������������������� 106
Exercises �������������������������������������������������������������������� 109
Strings and Number Systems ����������������������������������������� 109
The Positional System for Representing Numbers����������� 110
Converting Binary to Decimal �������������������������������������� 111
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
contents

Converting Decimal to Binary �������������������������������������� 112


Conversion Shortcuts ������������������������������������������������ 112
Octal and Hexadecimal Numbers ��������������������������������� 113
Exercises �������������������������������������������������������������������� 114
String Methods ������������������������������������������������������������ 115
vi Exercises �������������������������������������������������������������������� 118
Text Files �������������������������������������������������������������������� 118
Text Files and Their Format����������������������������������������� 118
Writing Text to a File �������������������������������������������������� 119
Writing Numbers to a File�������������������������������������������� 119
Reading Text from a File ��������������������������������������������� 120
Reading Numbers from a File �������������������������������������� 121
Accessing and Manipulating Files and Directories
on Disk ������������������������������������������������������������������ 122
Exercises �������������������������������������������������������������������� 125
Case Study: Text Analysis����������������������������������������������� 126
Summary �������������������������������������������������������������������� 130
Review Questions ��������������������������������������������������������� 131
Projects����������������������������������������������������������������������� 132

CHAPTER 5 Lis t s an d Dict io nari es ����������������������������� 134


Lists �������������������������������������������������������������������������� 135
List Literals and Basic Operators��������������������������������� 135
Replacing an Element in a List ������������������������������������ 138
List Methods for Inserting and Removing Elements��������� 138
Searching a List �������������������������������������������������������� 140
Sorting a List ����������������������������������������������������������� 140
Mutator Methods and the Value None ��������������������������� 141
Aliasing and Side Effects �������������������������������������������� 141
Equality: Object Identity and Structural
Equivalence ������������������������������������������������������������ 143
Example: Using a List to Find the Median
of a Set of Numbers ������������������������������������������������ 143
Tuples ��������������������������������������������������������������������� 144
Exercises �������������������������������������������������������������������� 145
Defining Simple Functions ��������������������������������������������� 146
The Syntax of Simple Function Definitions ��������������������� 146
Parameters and Arguments����������������������������������������� 147
The return Statement����������������������������������������������� 147
Boolean Functions ����������������������������������������������������� 148
Defining a main Function �������������������������������������������� 148
Exercises �������������������������������������������������������������������� 149
Case Study: Generating Sentences ��������������������������������� 150
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
contents

Dictionaries ����������������������������������������������������������������� 153


Dictionary Literals ����������������������������������������������������� 153
Adding Keys and Replacing Values�������������������������������� 154
Accessing Values ������������������������������������������������������ 154
Removing Keys ��������������������������������������������������������� 155
Traversing a Dictionary����������������������������������������������� 155 vii
Example: The Hexadecimal System Revisited����������������� 156
Example: Finding the Mode of a List of Values ��������������� 157
Exercises �������������������������������������������������������������������� 158
Case Study: Nondirective Psychotherapy�������������������������� 159
Summary �������������������������������������������������������������������� 163
Review Questions ��������������������������������������������������������� 164
Projects����������������������������������������������������������������������� 165

CHAPTER 6 Des ig n w it h F u ncti ons ����������������������������� 167


A Quick Review of What Functions Are and How
They Work ����������������������������������������������������������������� 168
Functions as Abstraction Mechanisms �������������������������� 169
Functions Eliminate Redundancy����������������������������������� 169
Functions Hide Complexity ������������������������������������������ 170
Functions Support General Methods with Systematic
Variations ��������������������������������������������������������������� 170
Functions Support the Division of Labor ����������������������� 171
Exercises �������������������������������������������������������������������� 171
Problem Solving with Top-Down Design����������������������������� 172
The Design of the Text-Analysis Program����������������������� 172
The Design of the Sentence-Generator Program�������������� 173
The Design of the Doctor Program�������������������������������� 174
Exercises �������������������������������������������������������������������� 176
Design with Recursive Functions�������������������������������������� 176
Defining a Recursive Function�������������������������������������� 176
Tracing a Recursive Function �������������������������������������� 177
Using Recursive Definitions to Construct Recursive
Functions ��������������������������������������������������������������� 178
Recursion in Sentence Structure����������������������������������� 179
Infinite Recursion ������������������������������������������������������ 179
The Costs and Benefits of Recursion����������������������������� 180
Exercises �������������������������������������������������������������������� 182
Case Study: Gathering Information from a File System�������� 183
Managing a Program’s Namespace ��������������������������������� 190
Module Variables, Parameters, and Temporary
Variables����������������������������������������������������������������� 190
Scope ��������������������������������������������������������������������� 191
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
contents

Lifetime�������������������������������������������������������������������� 192
Using Keywords for Default and Optional Arguments�������� 193
Exercises �������������������������������������������������������������������� 194
Higher-Order Functions�������������������������������������������������� 195
Functions as First-Class Data Objects��������������������������� 195
viii Mapping�������������������������������������������������������������������� 196
Filtering�������������������������������������������������������������������� 197
Reducing ����������������������������������������������������������������� 197
Using lambda to Create Anonymous Functions �������������� 198
Creating Jump Tables�������������������������������������������������� 199
Exercises �������������������������������������������������������������������� 199
Summary �������������������������������������������������������������������� 200
Review Questions ��������������������������������������������������������� 202
Projects����������������������������������������������������������������������� 203

CHAPTER 7 S im ple Gr aph ics and Image Processi ng ������� 205


Simple Graphics����������������������������������������������������������� 206
Overview of Turtle Graphics����������������������������������������� 206
Turtle Operations ������������������������������������������������������ 207
Setting Up a turtle.cfg File and Running IDLE����������������� 209
Object Instantiation and the turtle Module ������������������ 210
Drawing Two-Dimensional Shapes �������������������������������� 212
Examining an Object’s Attributes ��������������������������������� 213
Manipulating a Turtle’s Screen�������������������������������������� 214
Taking a Random Walk ���������������������������������������������� 214
Colors and the RGB System����������������������������������������� 215
Example: Filling Radial Patterns with Random
Colors�������������������������������������������������������������������� 216
Exercises �������������������������������������������������������������������� 218
Case Study: Recursive Patterns in Fractals����������������������� 218
Image Processing �������������������������������������������������������� 222
Analog and Digital Information�������������������������������������� 223
Sampling and Digitizing Images ����������������������������������� 223
Image File Formats����������������������������������������������������� 224
Image-Manipulation Operations ������������������������������������ 224
The Properties of Images�������������������������������������������� 225
The images Module ��������������������������������������������������� 225
A Loop Pattern for Traversing a Grid����������������������������� 228
A Word on Tuples ������������������������������������������������������ 229
Converting an Image to Black and White ����������������������� 230
Converting an Image to Grayscale�������������������������������� 231
Copying an Image ����������������������������������������������������� 232
Blurring an Image ������������������������������������������������������ 233
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
contents

Edge Detection ��������������������������������������������������������� 234


Reducing the Image Size �������������������������������������������� 235
Exercises �������������������������������������������������������������������� 237
Summary �������������������������������������������������������������������� 237
Review Questions ��������������������������������������������������������� 238
Projects����������������������������������������������������������������������� 240 ix

CHAPTER 8 G r aph ical Us er Inter faces ������������������������� 244


The Behavior of Terminal-Based Programs and ­GUI-Based
Programs ������������������������������������������������������������������ 245
The Terminal-Based Version����������������������������������������� 246
The GUI-Based Version ����������������������������������������������� 246
Event-Driven Programming ������������������������������������������ 248
Exercises �������������������������������������������������������������������� 249
Coding Simple GUI-Based Programs �������������������������������� 249
A Simple “Hello World” Program����������������������������������� 249
A Template for All GUI Programs����������������������������������� 251
The Syntax of Class and Method Definitions ������������������ 251
Subclassing and Inheritance as Abstraction
Mechanisms ����������������������������������������������������������� 252
Exercises �������������������������������������������������������������������� 253
Windows and Window Components����������������������������������� 253
Windows and Their Attributes �������������������������������������� 253
Window Layout����������������������������������������������������������� 254
Types of Window Components and Their Attributes��������� 256
Displaying Images ����������������������������������������������������� 257
Exercises �������������������������������������������������������������������� 259
Command Buttons and Responding to Events�������������������� 260
Exercises �������������������������������������������������������������������� 262
Input and Output with Entry Fields����������������������������������� 262
Text Fields ��������������������������������������������������������������� 262
Integer and Float Fields for Numeric Data ��������������������� 264
Using Pop-Up Message Boxes�������������������������������������� 265
Exercises �������������������������������������������������������������������� 267
Defining and Using Instance Variables ����������������������������� 267
Exercises �������������������������������������������������������������������� 269
Case Study: The Guessing Game Revisited����������������������� 269
Other Useful GUI Resources�������������������������������������������� 273
Using Nested Frames to Organize Components�������������� 273
Multi-Line Text Areas �������������������������������������������������� 275
File Dialogs �������������������������������������������������������������� 277
Obtaining Input with Prompter Boxes����������������������������� 280
Check Buttons����������������������������������������������������������� 281
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
contents

Radio Buttons ����������������������������������������������������������� 282


Keyboard Events�������������������������������������������������������� 284
Working with Colors��������������������������������������������������� 285
Using a Color Chooser ����������������������������������������������� 287
Summary �������������������������������������������������������������������� 289
x Review Questions ��������������������������������������������������������� 289
Projects����������������������������������������������������������������������� 290

CHAPTER 9 Des ig n w it h Clas ses �������������������������������� 293


Getting Inside Objects and Classes ��������������������������������� 294
A First Example: The Student Class����������������������������� 295
Docstrings ��������������������������������������������������������������� 297
Method Definitions����������������������������������������������������� 297
The __init __ Method and Instance Variables����������������� 298
The __str __ Method �������������������������������������������������� 299
Accessors and Mutators��������������������������������������������� 299
The Lifetime of Objects����������������������������������������������� 299
Rules of Thumb for Defining a Simple Class ������������������ 300
Exercises �������������������������������������������������������������������� 301
Case Study: Playing the Game of Craps��������������������������� 301
Data-Modeling Examples������������������������������������������������ 309
Rational Numbers ������������������������������������������������������ 309
Rational Number Arithmetic and Operator Overloading����� 311
Comparison Methods�������������������������������������������������� 312
Equality and the __eq__ Method����������������������������������� 313
Savings Accounts and Class Variables �������������������������� 314
Putting the Accounts into a Bank ��������������������������������� 317
Using pickle for Permanent Storage of Objects����������� 319
Input of Objects and the try-except Statement����������� 320
Playing Cards ����������������������������������������������������������� 321
Exercises �������������������������������������������������������������������� 324
Case Study: An ATM ����������������������������������������������������� 324
Building a New Data Structure: The Two-Dimensional Grid �� 330
The Interface of the Grid Class����������������������������������� 330
The Implementation of the Grid Class: Instance
Variables for the Data����������������������������������������������� 332
The Implementation of the Grid Class: Subscript
and Search�������������������������������������������������������������� 333
Case Study: Data Encryption with a Block Cipher �������������� 333
Structuring Classes with Inheritance and Polymorphism ����� 337
Inheritance Hierarchies and Modeling ��������������������������� 338
Example 1: A Restricted Savings Account ��������������������� 339
Example 2: The Dealer and a Player in the Game
ofRights
Copyright 2019 Cengage Learning. All Blackjack������������������������������������������������������������ 340
Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
contents

Polymorphic Methods������������������������������������������������� 344


The Costs and Benefits of Object-Oriented
Programming����������������������������������������������������������� 345
Exercises �������������������������������������������������������������������� 346
Summary �������������������������������������������������������������������� 347
Review Questions ��������������������������������������������������������� 348 xi
Projects����������������������������������������������������������������������� 349

CHAPTER 10 M u lt it h readin g , ­Networks, and Cl i ent/ Serv er


Pro g r am m in g ���������������������������������������� 352
Threads and Processes�������������������������������������������������� 353
Threads�������������������������������������������������������������������� 354
Sleeping Threads ������������������������������������������������������ 357
Producer, Consumer, and Synchronization �������������������� 358
Exercises �������������������������������������������������������������������� 364
The Readers and Writers Problem ����������������������������������� 364
Using the SharedCell Class �������������������������������������� 365
Implementing the Interface of the SharedCell Class ����� 366
Implementing the Helper Methods of the
SharedCell Class �������������������������������������������������� 368
Testing the SharedCell Class with a Counter Object ����� 369
Defining a Thread-Safe Class �������������������������������������� 370
Exercises �������������������������������������������������������������������� 371
Networks, Clients, and Servers �������������������������������������� 371
IP Addresses ������������������������������������������������������������ 372
Ports, Servers, and Clients ����������������������������������������� 373
Sockets and a Day/Time Client Script �������������������������� 373
A Day/Time Server Script�������������������������������������������� 375
A Two-Way Chat Script ����������������������������������������������� 377
Handling Multiple Clients Concurrently �������������������������� 378
Exercises �������������������������������������������������������������������� 380
Case Study: Setting Up Conversations between Doctors
and Patients �������������������������������������������������������������� 381
Summary �������������������������������������������������������������������� 386
Review Questions ��������������������������������������������������������� 387
Projects����������������������������������������������������������������������� 388

CHAPTER 11 S earch in g , ­So r ti ng, and Compl ex i ty Anal y si s� 390


Measuring the Efficiency of Algorithms����������������������������� 391
Measuring the Run Time of an Algorithm ����������������������� 391
Counting Instructions�������������������������������������������������� 394
Exercises
Copyright 2019 Cengage Learning. ��������������������������������������������������������������������
All Rights Reserved. 396
May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
contents

Complexity Analysis ������������������������������������������������������ 397


Orders of Complexity�������������������������������������������������� 397
Big-O Notation����������������������������������������������������������� 399
The Role of the Constant of Proportionality�������������������� 400
Measuring the Memory Used by an Algorithm����������������� 400
xii Exercises �������������������������������������������������������������������� 401
Search Algorithms �������������������������������������������������������� 401
Search for a Minimum ������������������������������������������������ 401
Sequential Search of a List ����������������������������������������� 402
Best-Case, Worst-Case, and Average-Case
Performance����������������������������������������������������������� 403
Binary Search of a List����������������������������������������������� 403
Exercises �������������������������������������������������������������������� 405
Basic Sort Algorithms ��������������������������������������������������� 405
Selection Sort����������������������������������������������������������� 406
Bubble Sort �������������������������������������������������������������� 407
Insertion Sort ����������������������������������������������������������� 408
Best-Case, Worst-Case, and Average-Case
Performance Revisited ��������������������������������������������� 410
Exercises �������������������������������������������������������������������� 410
Faster Sorting�������������������������������������������������������������� 411
Quicksort ����������������������������������������������������������������� 411
Merge Sort��������������������������������������������������������������� 415
Exercises �������������������������������������������������������������������� 418
An Exponential Algorithm: Recursive Fibonacci ����������������� 419
Converting Fibonacci to a Linear Algorithm����������������������� 420
Case Study: An Algorithm Profiler ����������������������������������� 421
Summary �������������������������������������������������������������������� 427
Review Questions ��������������������������������������������������������� 428
Projects����������������������������������������������������������������������� 429

APP ENDIX A Pyt h o n Res o u rce s ���������������������������������� 432

APP ENDIX B In s t allin g t h e i mages


an d br ee zy py th ongui Li brari es �������������� 434

APP ENDIX C T h e API f o r Im age Processi ng������������������� 436

APP ENDIX D Tr an s it io n f ro m Py thon to Jav a and C++ ����� 438

Glo s s ar y ���������������������������������������������� 439

In dex ���������������������������������������������������� 455


Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Preface
xiii

“Everyone should learn how to code.” That’s my favorite quote from Suzanne Keen, the
Thomas Broadus Professor of English and Dean of the College at Washington and Lee Uni-
versity, where I have taught computer science for more than 30 years. The quote also states
the reason why I wrote the first edition of Fundamentals of Python: First Programs, and why
I now offer you this second edition. The book is intended for an introductory course in pro-
gramming and problem solving. It covers the material taught in a typical Computer Science 1
course (CS1) at the undergraduate or high school level.
This book covers five major aspects of computing:
1. Programming Basics—Data types, control structures, algorithm development, and
program design with functions are basic ideas that you need to master in order to
solve problems with computers. This book examines these core topics in detail and
gives you practice employing your understanding of them to solve a wide range of
problems.
2. Object-Oriented Programming (OOP)—Object-oriented programming is the
dominant programming paradigm used to develop large software systems. This
book introduces you to the fundamental principles of OOP and enables you to
apply them successfully.
3. Data and Information Processing—Most useful programs rely on data structures
to solve problems. These data structures include strings, arrays, files, lists, and dic-
tionaries. This book introduces you to these commonly used data structures and
includes examples that illustrate criteria for selecting the appropriate data struc-
tures for given problems.
4. Software Development Life Cycle—Rather than isolate software development
techniques in one or two chapters, this book deals with them throughout in the
context of numerous case studies. Among other things, you’ll learn that coding a
program is often not the most difficult or challenging aspect of problem solving
and software development.
5. Contemporary Applications of Computing—The best way to learn about pro-
gramming and problem solving is to create interesting programs with real-world
applications. In this book, you’ll begin by creating applications that involve numeri-
cal problems and text processing. For example, you’ll learn the basics of encryption
techniques such as those that are used to make your credit card number and other
information secure on the Internet. But unlike many other introductory texts, this

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
P r e f a c e Why Python?

one does not restrict itself to problems involving numbers and text. Most contem-
porary applications involve graphical user interfaces, event-driven programming,
graphics, image manipulation, and network communications. These topics are not
consigned to the margins, but are presented in depth after you have mastered the
basics of programming.
xiv

Why Python?
Computer technology and applications have become increasingly more sophisticated over
the past three decades, and so has the computer science curriculum, especially at the intro-
ductory level. Today’s students learn a bit of programming and problem solving, and they
are then expected to move quickly into topics like software development, complexity analy-
sis, and data structures that, 30 years ago, were relegated to advanced courses. In addition,
the ascent of object-oriented programming as the dominant paradigm of problem solving
has led instructors and textbook authors to implant powerful, industrial-strength program-
ming languages such as C++ and Java in the introductory curriculum. As a result, instead
of experiencing the rewards and excitement of solving problems with computers, beginning
computer science students often become overwhelmed by the combined tasks of mastering
advanced concepts as well as the syntax of a programming language.
This book uses the Python programming language as a way of making the first year of
studying computer science more manageable and attractive for students and instructors
alike. Python has the following pedagogical benefits:
•• Python has simple, conventional syntax. Python statements are very close to those of
pseudocode algorithms, and Python expressions use the conventional notation found in
algebra. Thus, students can spend less time learning the syntax of a programming lan-
guage and more time learning to solve interesting problems.
•• Python has safe semantics. Any expression or statement whose meaning violates the
definition of the language produces an error message.
•• Python scales well. It is very easy for beginners to write simple programs in Python.
Python also includes all of the advanced features of a modern programming language,
such as support for data structures and object-oriented software development, for use
when they become necessary.
•• Python is highly interactive. Expressions and statements can be entered at an interpret-
er’s prompts to allow the programmer to try out experimental code and receive immedi-
ate feedback. Longer code segments can then be composed and saved in script files to
be loaded and run as modules or standalone applications.
•• Python is general purpose. In today’s context, this means that the language includes
resources for contemporary applications, including media computing and networks.
•• Python is free and is in widespread use in industry. Students can download Python to
run on a variety of devices. There is a large Python user community, and expertise in
Python programming has great résumé value.

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Organization of the Book pr e f a c e

To summarize these benefits, Python is a comfortable and flexible vehicle for expressing
ideas about computation, both for beginners and for experts. If students learn these ideas
well in the first course, they should have no problems making a quick transition to other
languages needed for courses later in the curriculum. Most importantly, beginning students
will spend less time staring at a computer screen and more time thinking about interesting
problems to solve. xv

Organization of the Book


The approach of this text is easygoing, with each new concept introduced only when it is
needed.
Chapter 1 introduces computer science by focusing on two fundamental ideas, algorithms
and information processing. A brief overview of computer hardware and software, followed
by an extended discussion of the history of computing, sets the context for computational
problem solving.
Chapters 2 and 3 cover the basics of problem solving and algorithm development using the
standard control structures of expression evaluation, sequencing, Boolean logic, selection,
and iteration with the basic numeric data types. Emphasis in these chapters is on problem
solving that is both systematic and experimental, involving algorithm design, testing, and
documentation.
Chapters 4 and 5 introduce the use of the strings, text files, lists, and dictionaries. These
data structures are both remarkably easy to manipulate in Python and support some inter-
esting applications. Chapter 5 also introduces simple function definitions as a way of orga-
nizing algorithmic code.
Chapter 6 explores the technique and benefits of procedural abstraction with function
definitions. Top-down design, stepwise refinement, and recursive design with functions are
examined as means of structuring code to solve complex problems. Details of namespace
organization (parameters, temporary variables, and module variables) and communica-
tion among software components are discussed. A section on functional programming
with higher-order functions shows how to exploit functional design patterns to simplify
solutions.
Chapter 7 focuses on the use of existing objects and classes to compose programs. ­Special
attention is paid to the application programming interface (API), or set of methods, of
a class of objects and the manner in which objects cooperate to solve problems. This
­chapter also introduces two contemporary applications of computing, graphics and
image ­processing—areas in which object-based programming is particularly useful.
Chapter 8 introduces the definition of new classes to construct graphical user interfaces
(GUIs). The chapter contrasts the event-driven model of GUI programs with the process-
driven model of terminal-based programs. The creation and layout of GUI components
are explored, as well as the design of GUI-based applications using the model/view pattern.
The initial approach to defining new classes in this chapter is unusual for an introductory

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
P r e f a c e Special Features

textbook: students learn that the easiest way to define a new class is to customize an exist-
ing class using subclassing and inheritance.
Chapter 9 continues the exploration of object-oriented design with the definition of entirely
new classes. Several examples of simple class definitions from different application domains
are presented. Some of these are then integrated into more realistic applications, to show
xvi how object-oriented software components can be used to build complex systems. Emphasis
is on designing appropriate interfaces for classes that exploit polymorphism.
Chapter 10 covers advanced material related to several important areas of computing:
concurrent programming, networks, and client/server applications. This chapter thus
gives students challenging experiences near the end of the first course. Chapter 10 intro-
duces multithreaded programs and the construction of simple network-based client/server
applications.
Chapter 11 covers some topics addressed at the beginning of a traditional CS2 course. This
chapter introduces complexity analysis with big-O notation. Enough material is presented
to enable you to perform simple analyses of the running time and memory usage of algo-
rithms and data structures, using search and sort algorithms as examples.

Special Features
This book explains and develops concepts carefully, using frequent examples and diagrams.
New concepts are then applied in complete programs to show how they aid in solving prob-
lems. The chapters place an early and consistent emphasis on good writing habits and neat,
readable documentation.
The book includes several other important features:
•• Case studies—These present complete Python programs ranging from the simple to
the substantial. To emphasize the importance and usefulness of the software develop-
ment life cycle, case studies are discussed in the framework of a user request, followed
by analysis, design, implementation, and suggestions for testing, with well-defined tasks
performed at each stage. Some case studies are extended in end-of-chapter program-
ming projects.
•• Chapter objectives and chapter summaries—Each chapter begins with a set of learning
objectives and ends with a summary of the major concepts covered in the chapter.
•• Key terms and a glossary—When a technical term is introduced in the text, it appears in
boldface. Definitions of the key terms are also collected in a glossary.
•• Exercises—Most major sections of each chapter end with exercise questions that rein-
force the reading by asking basic questions about the material in the section. Each chap-
ter ends with a set of review exercises.
•• Programming projects—Each chapter ends with a set of programming projects of vary-
ing difficulty.

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Instructor Resources pr e f a c e

•• A software toolkit for image processing—This book comes with an open-source


Python toolkit for the easy image processing discussed in Chapter 7. The toolkit can be
obtained from the student downloads page on www.cengage.com, or at http://home.wlu
.edu/~lambertk/python/
•• A software toolkit for GUI programming—This book comes with an open-source
Python toolkit for the easy GUI programming introduced in Chapter 8. The toolkit can xvii
be obtained from the student downloads page on www.cengage.com, or at http://home
.wlu.edu/~lambertk/breezypythongui/
•• Appendices—Four appendices include information on obtaining Python resources,
installing the toolkits, and using the toolkits’ interfaces.

New in This Edition


The most obvious change in this edition is the addition of full color. All program examples
include the color coding used in Python’s IDLE, so students can easily identify program
elements such as keywords, program comments, and function, method, and class names.
Several new figures have been added to illustrate concepts, and many exercises and pro-
gramming projects have been reworked. The brief history of computing in Chapter 1 has
been brought up to date. A discussion of a Grid type has been included to give students
exposure to a two-dimensional data structure. The book remains the only introductory
Python text with a thorough introduction to realistic GUI programming. The chapter
on GUIs (Chapter 8) now uses the breezypythongui toolkit to ease the introduction of
this topic. The chapter on GUIs has also been placed ahead of the chapter on design with
classes (Chapter 9). This arrangement allows students to explore the customizing of exist-
ing classes with GUI programming before they tackle the design of entirely new classes in
the following chapter. Finally, a new section on the readers and writers problem has been
added to Chapter 10, to illustrate thread-safe access to shared resources.

Instructor Resources
MindTap
MindTap activities for Fundamentals of Python: First Programs are designed to help stu-
dents master the skills they need in today’s workforce. Research shows employers need
critical thinkers, troubleshooters, and creative problem-solvers to stay relevant in our
fast-paced, technology-driven world. MindTap helps you achieve this with assignments
and activities that provide hands-on practice and real-life relevance. Students are guided
through assignments that help them master basic knowledge and understanding before
moving on to more challenging problems.
All MindTap activities and assignments are tied to defined unit learning objectives.
­Hands-on coding labs provide real-life application and practice. Readings and dynamic
visualizations support the lecture, while a post-course assessment measures exactly how

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
P r e f a c e We Appreciate Your Feedback

much a student has learned. MindTap provides the analytics and reporting to easily see
where the class stands in terms of progress, engagement, and completion rates. Use the
content and learning path as-is or pick-and-choose how our materials will wrap around
yours. You control what the students see and when they see it. Learn more at http://www
.cengage.com/mindtap/.
xviii

Instructor Companion Site


The following teaching tools are available for download at the Companion Site for this text.
Simply search for this text at www.cengagebrain.com and choose "Instructor Downloads."
An instructor login is required.
•• Instructor’s Manual: The Instructor’s Manual that accompanies this textbook includes
additional instructional material to assist in class preparation, including items such as
Overviews, Chapter Objectives, Teaching Tips, Quick Quizzes, Class Discussion Top-
ics, Additional Projects, Additional Resources, and Key Terms. A sample syllabus is also
available.
•• Test Bank: Cengage Testing Powered by Cognero is a flexible, online system that allows
you to:
•• author, edit, and manage test bank content from multiple Cengage solutions
•• create multiple test versions in an instant
•• deliver tests from your LMS, your classroom, or wherever you want
•• PowerPoint Presentations: This text provides PowerPoint slides to accompany each
chapter. Slides may be used to guide classroom presentations, to make available to stu-
dents for chapter review, or to print as classroom handouts. Files are provided for every
figure in the text. Instructors may use the files to customize PowerPoint slides, illustrate
quizzes, or create handouts.
•• Solutions: Solutions to all programming exercises are available. If an input file is
needed to run a programming exercise, it is included with the solution file.
•• Source Code: The source code is available at www.cengagebrain.com. If an input file is
needed to run a program, it is included with the source code.

We Appreciate Your Feedback


We have tried to produce a high-quality text, but should you encounter any errors,
please report them to [email protected] or http://support.cengage.com. A list of errata,
should they be found, as well as other information about the book, will be posted on
the Web site http://home.wlu.edu/~lambertk/python/ and with the student resources at
www.cengagebrain.com.

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Dedication pr e f a c e

Acknowledgments
I would like to thank my contributing author, Martin Osborne, for many years of advice,
friendly criticism, and encouragement on several of my book projects. I am also grateful
to the many students and colleagues at Washington and Lee University who have used this
book and given helpful feedback on it over the life of the first edition.
xix
In addition, I would like to thank the following reviewers for the time and effort they
contributed to Fundamentals of Python: Steven Robinett, Great Falls College Montana
State University; Mark Williams, University of Maryland Eastern Shore; Andrew ­Danner,
­Swarthmore College; Susan Fox, Macalester College; Emily Shepard, Central Carolina
Community College.
Also, thank you to the individuals at Cengage who helped to assure that the content of
all data and solution files used for this text were correct and accurate: John Freitas, MQA
­Project Leader, and Danielle Shaw, MQA Tester.
Finally, thanks to several other people whose work made this book possible: Kate Mason,
Associate Product Manager, Cengage; Natalie Pashoukos, Senior Content Developer,
­Cengage; and Jennifer Feltri-George, Senior Content Project Manager, Cengage. I also
want to thank Scarlett Lindsay for her superb copyediting of the book and Chandrasekar
­Subramanian for an excellent job managing the paging of the project.

Dedication
To my good friends, Lesley and David Novack
Kenneth A. Lambert
Lexington, VA

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Chapter 1
Introduction

After completing this chapter, you will be able to

Describe the basic features of an algorithm


Explain how hardware and software collaborate in
a ­computer’s architecture
Summarize a brief history of computing
Compose and run a simple Python program

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Chapter 1 Introduction

As a reader of this book, you almost certainly have played a video game and listened to
digital music. It’s likely that you have watched a digital movie after preparing a snack in a
microwave oven. Chances are that today you will make a phone call, send or receive a text
message, take a photo, or consult your favorite social network on a cell phone. You and your
friends have most likely used a desktop computer or a laptop computer to do some signifi-
2
cant coursework in high school or college.
These activities rely on something in common: computer technology. Computer technol-
ogy is almost everywhere, not only in our homes but also in our schools and in the places
where we work and play. Computer technology plays an important role in entertainment,
education, medicine, manufacturing, communications, government, and commerce. It
has been said that we have digital lifestyles and that we live in an information age with an
information-based economy. Some people even claim that nature itself performs computa-
tions on information structures present in DNA and in the relationships among subatomic
particles.
It’s difficult to imagine our world without computation, although we don’t think about the
actual computers very much. It’s also hard to imagine that the human race did without
computer technology for thousands of years, and that computer technology has pervaded
the world as we know it for only the past 30 years or so.
In the following chapters, you will learn about computer science, which is the study of com-
putation that has made this new technology and this new world possible. You will also learn
how to use computers effectively and appropriately to enhance your own life and the lives
of others.

Two Fundamental Ideas of Computer Science:


­Algorithms and Information Processing
Like most areas of study, computer science focuses on a broad set of interrelated ideas.
Two of the most basic ones are algorithms and information processing. In this section,
these ideas are introduced in an informal way. We will examine them in more detail
in later chapters.

Algorithms
People computed long before the invention of modern computing devices, and many con-
tinue to use computing devices that we might consider primitive. For example, consider
how merchants made change for customers in marketplaces before the existence of credit
cards, pocket calculators, or cash registers. Making change can be a complex activity. It
probably took you some time to learn how to do it, and it takes some mental effort to get it
right every time. Let’s consider what’s involved in this process.
According to one method, the first step is to compute the difference between the pur-
chase price and the amount of money that the customer gives the merchant. The result of

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Two Fundamental Ideas of Computer Science

this calculation is the total amount that the merchant must return to the purchaser. For
example, if you buy a dozen eggs at the farmers’ market for $2.39 and you give the farmer a
$10 bill, she should return $7.61 to you. To produce this amount, the merchant selects the
appropriate coins and bills that, when added to $2.39, make $10.00.
According to another method, the merchant starts with the purchase price and goes toward
the amount given. First, coins are selected to bring the price to the next dollar amount (in 3
this case, $0.61 5 3 dimes, 1 nickel, and 4 pennies), then dollars are selected to bring the
price to the next 5-dollar amount (in this case, $2), and then, in this case, a $5 bill completes
the transaction. As you will see in this book, there can be many possible methods or algo-
rithms that solve the same problem, and the choice of the best one is a skill you will acquire
with practice.
Few people can subtract three-digit numbers without resorting to some manual aids,
such as pencil and paper. As you learned in grade school, you can carry out subtraction
with pencil and paper by following a sequence of well-defined steps. You have probably
done this many times but never made a list of the specific steps involved. Making such
lists to solve problems is something computer scientists do all the time. For example, the
following list of steps describes the process of subtracting two numbers using a pencil
and paper:
Step 1 Write down the two numbers, with the larger number above the smaller num-
ber and their digits aligned in columns from the right.
Step 2 Assume that you will start with the rightmost column of digits and work your
way left through the various columns.
Step 3 Write down the difference between the two digits in the current column
of digits, borrowing a 1 from the top number’s next column to the left if
necessary.
Step 4 If there is no next column to the left, stop. Otherwise, move to the next col-
umn to the left, and go back to Step 3.
If the computing agent (in this case a human being) follows each of these simple steps cor-
rectly, the entire process results in a correct solution to the given problem. We assume in
Step 3 that the agent already knows how to compute the difference between the two digits
in any given column, borrowing if necessary.
To make change, most people can select the combination of coins and bills that represent
the correct change amount without any manual aids, other than the coins and bills. But the
mental calculations involved can still be described in a manner similar to the preceding
steps, and we can resort to writing them down on paper if there is a dispute about the cor-
rectness of the change.
The sequence of steps that describes each of these computational processes is called an
algorithm. Informally, an algorithm is like a recipe. It provides a set of instructions that
tells us how to do something, such as make change, bake bread, or put together a piece of
furniture. More precisely, an algorithm describes a process that ends with a solution to a

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Chapter 1 Introduction

problem. The algorithm is also one of the fundamental ideas of computer science. An algo-
rithm has the following features:
1. An algorithm consists of a finite number of instructions.
2. Each individual instruction in an algorithm is well defined. This means that the
4 action described by the instruction can be performed effectively or be executed
by a computing agent. For example, any computing agent capable of arithmetic can
compute the difference between two digits. So an algorithmic step that says “com-
pute the difference between two digits” would be well defined. On the other hand,
a step that says “divide a number by 0” is not well defined, because no computing
agent could carry it out.
3. An algorithm describes a process that eventually halts after arriving at a solution to
a problem. For example, the process of subtraction halts after the computing agent
writes down the difference between the two digits in the leftmost column of digits.
4. An algorithm solves a general class of problems. For example, an algorithm that
describes how to make change should work for any two amounts of money whose
difference is greater than or equal to $0.00.
Creating a list of steps that describe how to make change might not seem like a major
accomplishment to you. But the ability to break a task down into its component parts is one
of the main jobs of a computer programmer. Once we write an algorithm to describe a par-
ticular type of computation, we can build a machine to do the computing. Put another way,
if we can develop an algorithm to solve a problem, we can automate the task of solving the
problem. You might not feel compelled to write a computer program to automate the task
of making change, because you can probably already make change yourself fairly easily. But
suppose you needed to do a more complicated task—such as sorting a list of 100 names. In
that case, a computer program would be very handy.
Computers can be designed to run a small set of algorithms for performing specialized tasks
such as operating a microwave oven. But we can also build computers, like the one on your
desktop, that are capable of performing a task described by any algorithm. These computers
are truly general-purpose problem-solving machines. They are unlike any machines we have
ever built before, and they have formed the basis of the completely new world in which we live.
Later in this book, we introduce a notation for expressing algorithms and some suggestions
for designing algorithms. You will see that algorithms and algorithmic thinking are critical
underpinnings of any computer system.

Information Processing
Since human beings first learned to write several thousand years ago, they have pro-
cessed information. Information itself has taken many forms in its history, from the marks
impressed on clay tablets in ancient Mesopotamia; to the first written texts in ancient

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Two Fundamental Ideas of Computer Science

Greece; to the printed words in the books, newspapers, and magazines mass-produced
since the European Renaissance; to the abstract symbols of modern mathematics and sci-
ence used during the past 350 years. Only recently, however, have human beings developed
the capacity to automate the processing of information by building computers. In the
modern world of computers, information is also commonly referred to as data. But what is
information? 5
Like mathematical calculations, information processing can be described with algorithms.
In our earlier example of making change, the subtraction steps involved manipulating sym-
bols used to represent numbers and money. In carrying out the instructions of any algo-
rithm, a computing agent manipulates information. The computing agent starts with some
given information (known as input), transforms this information according to well-defined
rules, and produces new information, known as output.
It is important to recognize that the algorithms that describe information processing can
also be represented as information. Computer scientists have been able to represent algo-
rithms in a form that can be executed effectively and efficiently by machines. They have
also designed real machines, called electronic digital computers, which are capable of exe-
cuting algorithms.
Computer scientists more recently discovered how to represent many other things, such as
images, music, human speech, and video, as information. Many of the media and commu-
nication devices that we now take for granted would be impossible without this new kind
of information processing. We examine many of these achievements in more detail in later
chapters.

Exercises
These short end-of-section exercises are intended to stimulate your thinking about
computing.

1. List three common types of computing agents.


2. Write an algorithm that describes the second part of the process of making change
(counting out the coins and bills).
3. Write an algorithm that describes a common task, such as baking a cake or operat-
ing a DVD player.
4. Describe an instruction that is not well defined and thus could not be included as a
step in an algorithm. Give an example of such an instruction.
5. In what sense is a laptop computer a general-purpose problem-solving machine?
6. List four devices that use computers and describe the information that they process.
(Hint: Think of the inputs and outputs of the devices.)

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Chapter 1 Introduction

The Structure of a Modern Computer System


We now give a brief overview of the structure of modern computer systems. A modern
computer system consists of hardware and software. Hardware consists of the physical
devices required to execute algorithms. Software is the set of these algorithms, represented
as programs, in particular programming languages. In the discussion that follows, we
6 focus on the hardware and software found in a typical desktop computer system, although
similar components are also found in other computer systems, such as handheld devices
and ATMs (automatic teller machines).

Computer Hardware
The basic hardware components of a computer are memory, a central processing unit
(CPU), and a set of input/output devices, as shown in Figure 1-1.

Input device Output device

Memory

CPU

Figure 1-1 Hardware components of a modern computer system

Human users primarily interact with the input and output devices. The input devices
include a keyboard, a mouse, a trackpad, a microphone, and a touchscreen. Common out-
put devices include a monitor and speakers. Computers can also communicate with the
external world through various ports that connect them to networks and to other devices
such as smartphones and digital cameras. The purpose of most input devices is to convert
information that human beings deal with, such as text, images, and sounds, into informa-
tion for computational processing. The purpose of most output devices is to convert the
results of this processing back to human-usable form.
Computer memory is set up to represent and store information in electronic form. Specifi-
cally, information is stored as patterns of binary digits (1s and 0s). To understand how this
works, consider a basic device such as a light switch, which can only be in one of two states,
on or off. Now suppose there is a bank of switches that control 16 small lights in a row. By
turning the switches off or on, we can represent any pattern of 16 binary digits (1s and 0s)
as patterns of lights that are on or off. As we will see later in this book, computer scientists
have discovered how to represent any information, including text, images, and sound, in
binary form.
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
The Structure of a Modern Computer System

Now, suppose there are 8 of these groups of 16 lights. We can select any group of lights and
examine or change the state of each light within that collection. We have just developed a
tiny model of computer memory. The memory has 8 cells, each of which can store 16 bits
of binary information. A diagram of this model, in which the memory cells are filled with
binary digits, is shown in Figure 1-2. This memory is also sometimes called primary or
internal or random access memory (RAM).
7

Cell 7 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 1
Cell 6 1 0 1 1 0 1 1 1 1 1 1 0 1 1 1 1
Cell 5 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1
Cell 4 1 0 1 1 1 0 1 1 1 1 1 1 0 1 1 1
Cell 3 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1
Cell 2 0 0 1 1 1 1 0 1 1 1 0 1 1 1 0 1
Cell 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1
Cell 0 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 0

Figure 1-2 A model of computer memory

The information stored in memory can represent any type of data, such as numbers, text,
images, or sound, or the instructions of a program. We can also store in memory an algorithm
encoded as binary instructions for the computer. Once the information is stored in memory, we
typically want to do something with it—that is, we want to process it. The part of a computer
that is responsible for processing data is the central processing unit (CPU). This device, which
is also sometimes called a processor, consists of electronic switches arranged to perform sim-
ple logical, arithmetic, and control operations. The CPU executes an algorithm by fetching its
binary instructions from memory, decoding them, and executing them. Executing an instruc-
tion might involve fetching other binary information—the data—from memory as well.
The processor can locate data in a computer’s primary memory very quickly. However, these
data exist only as long as electric power comes into the computer. If the power fails or is turned
off, the data in primary memory are lost. Clearly, a more permanent type of memory is needed
to preserve data. This more permanent type of memory is called external or s­ econdary
­memory, and it comes in several forms. Magnetic storage media, such as tapes and hard
disks, allow bit patterns to be stored as patterns on a magnetic field. Semiconductor storage
media, such as flash memory sticks, perform much the same function with a different technol-
ogy, as do optical storage media, such as CDs and DVDs. Some of these secondary storage
media can hold much larger quantities of information than the internal memory of a computer.

Computer Software
You have learned that a computer is a general-purpose problem-solving machine. To
solve any computable problem, a computer must be capable of executing any algorithm.
Because it is impossible to anticipate all of the problems for which there are ­algorithmic
solutions, there is no way to “hardwire” all potential algorithms into a computer’s
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Other documents randomly have
different content
The Project Gutenberg eBook of Man's Place in
Nature, and Other Essays
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

Title: Man's Place in Nature, and Other Essays

Author: Thomas Henry Huxley

Release date: July 16, 2012 [eBook #40257]


Most recently updated: October 23, 2024

Language: English

Credits: Produced by Pat McCoy, Adrian Mastronardi and the


Online
Distributed Proofreading Team at http://www.pgdp.net
(This
file was produced from images generously made
available
by The Internet Archive/Canadian Libraries)

*** START OF THE PROJECT GUTENBERG EBOOK MAN'S PLACE IN


NATURE, AND OTHER ESSAYS ***
EVERYMAN’S LIBRARY

EDITED BY ERNEST RHYS

SCIENCE

HUXLEY’S ESSAYS

WITH AN INTRODUCTION BY

SIR OLIVER LODGE


THE PUBLISHERS OF EVERYMAN’S LIBRARY WILL BE PLEASED TO SEND
FREELY TO ALL APPLICANTS A LIST OF THE PUBLISHED AND PROJECTED
VOLUMES TO BE COMPRISED UNDER THE FOLLOWING TWELVE
HEADINGS:

TRAVEL ☙ SCIENCE ☙ FICTION


THEOLOGY & PHILOSOPHY
HISTORY ☙ CLASSICAL
CHILDREN’S BOOKS
ESSAYS ☙ ORATORY
POETRY & DRAMA
BIOGRAPHY
ROMANCE

IN TWO STYLES OF BINDING, CLOTH, FLAT BACK, COLOURED TOP,


AND LEATHER, ROUND CORNERS, GILT TOP.
London: J. M. DENT & CO.

First Edition, February 1906

Reprinted July 1906


CONTENTS
PAGE
I. On the Natural History of the Man-Like Apes 1
II. On the Relations of Man to the Lower Animals 52
III. On Some Fossil Remains of Man 111
IV. The Present Condition of Organic Nature 151
V. The Past Condition of Organic Nature 168
The Method by which the Causes of the Present and Past
VI.
Conditions of Organic
Nature are to be Discovered.—The Origination of Living
186
Beings
The Perpetuation of Living Beings, Hereditary Transmission
VII. 208
and Variation
The Conditions of Existence as Affecting the Perpetuation of
VIII. 225
Living Beings
A Critical Examination of the Position of Mr. Darwin’s Work,
IX.
“On the
Origin of Species,” in Relation to the Complete Theory of the
Causes of the
Phenomena of Organic Nature 245
X. On the Educational Value of the Natural History Sciences 264
(Lecture delivered at St. Martin’s Hall, July 22, 1854).
XI. On the Persistent Types of Animal Life 283
(Lecture delivered at the Royal Institution, June 3,
1859.)
XII. Time and Life 287
(Macmillan’s Magazine, December 1859.)
XIII. Darwin on the Origin of Species 299
(Westminster Review, April 1860.)
XIV. The Darwinian Hypothesis 337
(Times, December 26, 1859.)
XV. A Lobster; or, The Study of Zoology 352
(Lecture delivered at South Kensington Museum, May
14, 1860).
INTRODUCTION
Forty years ago the position of scientific studies was not so firmly
established as it is to-day, and a conflict was necessary to secure
their general recognition. The forces of obscurantism and of free and
easy dogmatism were arrayed against them; and, just as in former
centuries astronomy, and in more recent times geology, so in our
own lifetime biology, has had to offer a harsh and fighting front, lest
its progress be impeded by the hostility born of preconceived
opinions, and by the bigotry of self-appointed guardians of
conservative views.
The man who probably did as much as any to fight the battle of
science in the nineteenth century, and secure the victory for free
enquiry and progressive knowledge, is Thomas Henry Huxley; and it
is an interesting fact that already the lapse of time is making it
possible to bring his writings in cheap form to the notice of a
multitude of interested readers. The pugnacious attitude, however,
which, forty years ago, was appropriate, has become a little antique
now; the conflict is not indeed over, but it has either totally shifted
its ground, or is continued on the old battlefield chiefly by survivors,
and by a few of a younger generation who have been brought up in
the old spirit.
The truths of materialism now run but little risk of being denied or
ignored, they run perhaps some danger of being exaggerated.
Brilliantly true and successful in their own territory, they are
occasionally pushed by enthusiastic disciples over the frontier line
into regions where they can do nothing but break down. As if
enthusiastic worshippers of motor-cars, proud of their performance
on the good roads of France, should take them over into the Sahara
or essay them on a Polar expedition.
That represents the mistake which, in modern times, by careless
thinkers, is being made. They tend to press the materialistic
statements and scientific doctrines of a great man like Huxley, as if
they were co-extensive with all existence. This is not really a
widening of the materialistic aspect of things, it is a cramping of
everything else; it is an attempt to limit the universe to one of its
aspects.
But the mistake is not made solely, nor even chiefly, by those eager
disciples who are pursuing the delusive gleam of a materialistic
philosophy—for these there is hope,—to attempt is a healthy
exercise, and they will find out their mistake in time; but the mistake
is also made by those who are specially impressed with the spiritual
side of things, who so delight to see guidance and management
everywhere, that they wish to blind their eyes to the very
mechanism whereby it is accomplished. They think that those who
point out and earnestly study the mechanism are undermining the
foundations of faith. Nothing of the kind. A traveller in the deck-
cabin of an Atlantic liner may prefer to ignore the engines and the
firemen, and all the machinery and toil which is urging him
luxuriously forward over the waves in the sunshine; he may try to
imagine that he is on a sailing vessel propelled by the free air of
heaven alone; but there is just as much utilization of natural forces
to a desired end in one case of navigation as in the other, and every
detail of the steamship, down to the last drop of sweat from a
fireman’s grimy body, is an undeniable reality.
There are people who still resent the conclusions of biology as to
man’s place in nature, and try to counteract them; but, as the late
Professor Ritchie said (“Philosophical Studies,” page 24)—
“It is a mistake, which has constantly been made in the past by those who
are anxious for the spiritual interests of man, to interfere with the changes
which are going on in scientific conceptions. Such interference has always
ended in the defeat of the supporters of the quasi-scientific doctrines
which the growing science of the time has discarded. Theology interfered
with Galileo, and gained nothing in the end by its interference. Astronomy,
geology, biology, anthropology, historical criticism, have at different
periods raised alarm in the minds of those who dread a materialistic view
of man’s nature; and with the very best intentions they have tried to fight
the supposed enemy on his own ground, eagerly welcoming, for instance,
every sign of disagreement between Darwinians and Lamarckians, or
every dispute between different schools of historical critics, as if the
spiritual well-being of mankind were bound up with the scientific beliefs of
the seventeenth, or even earlier, century, as if e.g. it made all the
difference in man’s spiritual nature whether he was made directly out of
inorganic dust or slowly ascended from lower organic forms. These are
questions that must be settled by specialists. On the other hand,
philosophic criticism is in place when the scientific specialist begins to
dogmatize about the universe as a whole, when he speaks for example as
if an accurate narrative of the various steps by which the lower forms of
life have passed into the higher was a sufficient explanation to us of the
mystery of existence.”

Let it be understood, therefore, that science is one thing, and


philosophy another: that science most properly concerns itself with
matter and motion, and reduces phenomena, as far as it can, to
mechanism. The more successfully it does that, the more it fulfils its
end and aim; but when, on the strength of that achievement, it
seeks to blossom into a philosophy, when it endeavours to conclude
that its scope is complete and all-inclusive, that nothing exists in the
universe but mechanism, and that the aspect of things from a
scientific point of view is their only aspect,—then it is becoming
narrow and bigoted and deserving of rebuke. Such rebuke it
received from Huxley, such rebuke it will always receive from
scientific men who realize properly the magnitude of existence and
the vast potentialities of the universe.
Our opportunities of exploration are good as far as they go, but they
are not extensive; we live as it were in the mortar of one of the
stones of St. Paul’s Cathedral; and yet so assiduously have we
cultivated our faculties that we can trace something of the outline of
the whole design and have begun to realize the plan of the building
—a surprising feat for insects of limited faculty. And—continuing the
parable—two schools of thought have arisen: one saying that it was
conceived in the mind of an architect and designed and built wholly
by him, the other saying that it was put together stone by stone in
accordance with the laws of mechanics and physics. Both statements
are true, and those that emphasize the latter are not thereby
denying the existence of Christopher Wren, though to the unwise
enthusiasts on the side of design they may appear to be doing so.
Each side is stating a truth, and neither side is stating the whole
truth. Nor should we find it easy with all our efforts to state the
whole truth exhaustively, even about such a thing as that. Those
who deny any side of truth are to that extent unbelievers, and
Huxley was righteously indignant with those shortsighted bigots who
blasphemed against that aspect of divine truth which had been
specially revealed to him. This is what he lived to preach, and to this
he was faithful to the uttermost.
Let him be thought of as a devotee of truth, and a student of the
more materialistic side of things, but never let him be thought of as
a philosophical materialist or as one who abounded in cheap
negations.
The objection which it is necessary to express concerning
Materialism as a complete system is based not on its assertions but
on its negations. In so far as it makes positive assertions, embodying
the result of scientific discovery and even of scientific speculation
based thereupon, there is no fault to find with it; but when, on the
strength of that, it sets up to be a philosophy of the universe—all
inclusive, therefore, and shutting out a number of truths otherwise
perceived, or which appeal to other faculties, or which are equally
true and are not really contradictory of legitimately materialistic
statements—then it is that its insufficiency and narrowness have to
be displayed. As Professor Ritchie said:—“The ‘legitimate materialism
of the sciences’ simply means temporary and convenient abstraction
from the cognitive conditions under which there are ‘facts’ or
‘objects’ for us at all; it is ‘dogmatic materialism’ which is
metaphysics of the bad sort.”
It will be probably instructive, and it may be sufficient, if I show that
two great leaders in scientific thought (one the greatest of all men of
science who have yet lived), though well aware of much that could
be said positively on the materialistic side, and very willing to admit
or even to extend the province of science or exact knowledge to the
uttermost, yet were very far from being philosophic materialists or
from imagining that other modes of regarding the universe were
thereby excluded.
Great leaders of thought, in fact, are not accustomed to take a
narrow view of existence, or to suppose that one mode of regarding
it, or one set of formulæ expressing it, can possibly be sufficient and
complete. Even a sheet of paper has two sides: a terrestrial globe
presents different aspects from different points of view; a crystal has
a variety of facets; and the totality of existence is not likely to be
more simple than any of these—is not likely to be readily expressible
in any form of words, or to be thoroughly conceivable by any human
mind.
It may be well to remember that Sir Isaac Newton was a Theist of
the most pronounced and thorough conviction, although he had a
great deal to do with the reduction of the major Cosmos to
mechanics, i.e., with its explanation by the elaborated machinery of
simple forces; and he conceived it possible that, in the progress of
science, this process of reduction to mechanics would continue till it
embraced nearly all the phenomena of nature. (See extract below.)
That, indeed, has been the effort of science ever since, and therein
lies the legitimate basis for materialistic statements, though not for a
materialistic philosophy.
The following sound remarks concerning Newton are taken from
Huxley’s “Hume,” p. 246:—
“Newton demonstrated all the host of heaven to be but the elements of a
vast mechanism, regulated by the same laws as those which express the
falling of a stone to the ground. There is a passage in the preface to the
first edition of the ‘Principia’ which shows that Newton was penetrated, as
completely as Descartes, with the belief that all the phenomena of nature
are expressible in terms of matter and motion:—
“‘Would that the rest of the phenomena of nature could be deduced by a
like kind of reasoning from mechanical principles. For many circumstances
lead me to suspect that all these phenomena may depend upon certain
forces, in virtue of which the particles of bodies, by causes not yet known,
are either mutually impelled against one another, and cohere into regular
figures, or repel and recede from one another; which forces being
unknown, philosophers have as yet explored nature in vain. But I hope
that, either by this method of philosophizing, or by some other and better,
the principles here laid down may throw some light upon the matter.’”

Here is a full-blown anticipation of an intelligible exposition of the


Universe in terms of matter and force—the substantial basis of what
smaller men call materialism and develop into what they consider to
be a materialistic philosophy. But there is no necessity for any such
scheme; and Professor Huxley himself, who is commonly spoken of
by half-informed people as if he were a philosophic materialist, was
really nothing of the kind; for although, like Newton, fully imbued
with the mechanical doctrine, and of course far better informed
concerning the biological departments of nature, and the discoveries
which have in the last century been made,—and though he rightly
regarded it as his mission to make the scientific point of view clear
to his benighted contemporaries, and was full of enthusiasm for the
facts on which materialists take their stand,—he saw clearly that
these alone were insufficient for a philosophy. The following extracts
from the Hume volume will show that he entirely repudiated
materialism as a satisfactory or complete philosophical system, and
that he was especially severe on gratuitous denials applied to
provinces beyond our scope:—
“While it is the summit of human wisdom to learn the limit of our faculties,
it may be wise to recollect that we have no more right to make denials,
than to put forth affirmatives, about what lies beyond that limit. Whether
either mind or matter has a ‘substance’ or not, is a problem which we are
incompetent to discuss: and it is just as likely that the common notions
upon the subject should be correct as any others.... ‘The same principles
which, at first view, lead to scepticism, pursued to a certain point, bring
men back to common sense’ ” (p. 282).
“Moreover, the ultimate forms of existence which we distinguish in our
little speck of the universe are, possibly, only two out of infinite varieties
of existence, not only analogous to matter and analogous to mind, but of
kinds which we are not competent so much as to conceive,—in the midst
of which, indeed, we might be set down, with no more notion of what was
about us, than the worm in a flower-pot, on a London balcony, has of the
life of the great city.” (p. 286)

And again on pp. 251 and 279:—


“It is worth any amount of trouble to ... know by one’s own knowledge
the great truth ... that the honest and rigorous following up of the
argument which leads us to ‘materialism’ inevitably carries us beyond it.”
“To sum up. If the materialist affirms that the universe and all its
phenomena are resolvable into matter and motion, Berkeley replies, True;
but what you call matter and motion are known to us only as forms of
consciousness; their being is to be conceived or known; and the existence
of a state of consciousness apart from a thinking mind is a contradiction in
terms.
“I conceive that this reasoning is irrefragable. And, therefore, if I were
obliged to choose between absolute materialism and absolute idealism, I
should feel compelled to accept the latter alternative.”

Let the jubilant but uninstructed and comparatively ignorant amateur


materialist therefore beware, and bethink himself twice or even
thrice before he conceives that he understands the universe and is
competent to pour scorn upon the intuitions and perceptions of
great men in what may be to him alien regions of thought and
experience.
Let him explain, if he can, what he means by his own identity, or the
identity of any thinking or living being, which at different times
consists of a totally different set of material particles. Something
there clearly is which confers personal identity and constitutes an
individual: it is a property characteristic of every form of life, even
the humblest; but it is not yet explained or understood, and it is no
answer to assert gratuitously that there is some fundamental
substance or material basis on which that identity depends, any
more than it is an explanation to say that it depends upon a soul.
These are all forms of words. As Hume says, quoted by Huxley with
approval, in the work already cited, p. 194:—
“It is impossible to attach any definite meaning to the word ‘substance,’
when employed for the hypothetical substratum of soul and matter.... If it
be said that our personal identity requires the assumption of a substance
which remains the same while the accidents of perception shift and
change, the question arises what is meant by personal identity?... A plant
or an animal, in the course of its existence, from the condition of an egg
or seed to the end of life, remains the same neither in form, nor in
structure, nor in the matter of which it is composed: every attribute it
possesses is constantly changing, and yet we say that it is always one and
the same individual” (p. 194).

And in his own preface to the Hume volume Huxley expresses


himself forcibly thus—equally antagonistic as was his wont to both
ostensible friend and ostensible foe, as soon as they got off what he
considered the straight path:—
“That which it may be well for us not to forget is, that the first-recorded
judicial murder of a scientific thinker [Socrates] was compassed and
effected, not by a despot, nor by priests, but was brought about by
eloquent demagogues.... Clear knowledge of what one does not know is
just as important as knowing what one does know....
“The development of exact natural knowledge in all its vast range, from
physics to history and criticism, is the consequence of the working out, in
this province, of the resolution to ‘take nothing for truth without clear
knowledge that it is such’; to consider all beliefs open to criticism; to
regard the value of authority as neither greater nor less, than as much as
it can prove itself to be worth. The modern spirit is not the spirit ‘which
always denies,’ delighting only in destruction; still less is it that which
builds castles in the air rather than not construct; it is that spirit which
works and will work ‘without haste and without rest,’ gathering harvest
after harvest of truth into its barns, and devouring error with
unquenchable fire” (p. viii).

The harvesting of truth is a fairly safe operation, for if some


falsehood be inadvertently harvested along with the grain we may
hope that, having a less robust and hardy nature, it will before long
be detected by its decaying odour; but the rooting up and devouring
of error with unquenchable fire is a more dangerous enterprise,
inasmuch as flames are apt to spread beyond our control; and the
lack of infallibility in the selection of error may to future generations
become painfully apparent.
The phrase represents a good healthy energetic mood however, and
in a world liable to become overgrown with weeds and choked with
refuse, the cleansing work of a firebrand may from time to time be a
necessity, in order that the free wind of heaven and the sunlight may
once more reach the fertile soil.
But it is unfair to think of Huxley even when young as a firebrand,
though it is true that he was to some extent a man of war, and
though the fierce and consuming mood is rather more prominent in
his early writings than in his later work.
A fighting attitude was inevitable forty years ago, because then the
truths of biology were being received with hostility, and the free
science and philosophy of a later time seemed likely to have a poor
chance of life. But the world has changed or is changing now, the
wholesome influences of fire have done their work, and it would be
a rather barbarous anachronism to apply the same agency among
the young green shoots of healthy learning which are springing up in
the cleared ground.
OLIVER LODGE.
1906.

Among the earlier published works of T. H. Huxley (1825-1895), and


of the essays contained in this volume: “The Darwinian Hypothesis”
first appeared in the Times, Dec. 26, 1859; “On the Educational
Value of the Natural History Sciences” (Address given at St. Martin’s
Hall), was published in 1854; “Time and Life” (Macmillan’s
Magazine), Dec. 1859; “The Origin of Species” (Westminster
Review), April 1860; “A Lobster: or, The Study of Zoology,” 1861.
“Geological Contemporaneity and Persistent Types of Life” (Address
to Geological Society), 1862, was re-published in “Lay Sermons,” vol.
viii.; “Six Lectures to Working Men on the Phenomena of Organic
Nature,” 1863, in “Collected Essays,” vol. vii. “Evidence as to Man’s
Place in Nature,” 1863. Of his other works, the translation by Huxley
and Busk of “Kölliker’s Manual of Human Histology,” appeared in
1853. “Lectures on the Elements of Comparative Anatomy,”
“Elementary Atlas of Comparative Osteology”; two Science Lectures,
“The Circulation of the Blood” and “Corals and Coral Reefs,” and
“Lessons in Elementary Physiology,” in 1866. “Introduction to the
Classification of Animals,” 1869. “Lay Sermons, Essays, and
Reviews,” 1870. “Critiques and Addresses,” 1873. “On Yeast: A
Lecture,” 1872. “A Manual of the Anatomy of Vertebrated Animals,”
1871. “Manual of the Anatomy of Invertebrated Animals,” 1877.
“American Addresses,” 1877. “Physiography,” 1877. “Hume” in
“English Men of Letters,” 1878. “The Crayfish: an Introduction to the
Study of Zoology,” 1880. “Science and Culture, and other Essays,”
1881. “Essays upon some Controverted Questions,” 1892. “Evolution
and Ethics” (the Romanes Lecture), 1893. Huxley also assisted in
editing the series of Science Primers published by Messrs. Macmillan,
and contributed the introductory volume himself. The “Collected
Essays,” in nine vols., containing all that he cared to preserve, 1893.
“The Scientific Memoirs of T. H. Huxley,” edited by Professor Michael
Foster and Professor E. Ray Lankester, in five vols., 1898-1903. His
“Life and Letters,” edited by his son, Leonard Huxley, was published
in 1900.
Photographically reduced from Diagrams of the natural size (except
that of the Gibbon, which was twice as large as nature), drawn by Mr.
Waterhouse Hawkins from specimens in the Museum of the Royal
College of Surgeons.
HUXLEY’S ESSAYS
I

ON THE NATURAL HISTORY OF THE


MAN-LIKE APES.
Ancient traditions, when tested by the severe processes of modern
investigation, commonly enough fade away into mere dreams: but it
is singular how often the dream turns out to have been a half-
waking one, presaging a reality. Ovid foreshadowed the discoveries
of the geologist: the Atlantis was an imagination, but Columbus
found a western world: and though the quaint forms of Centaurs
and Satyrs have an existence only in the realms of art, creatures
approaching man more nearly than they in essential structure, and
yet as thoroughly brutal as the goat’s or horse’s half of the mythical
compound, are now not only known, but notorious.
I have not met with any notice of one of these Man-like Apes of
earlier date than that contained in Pigafetta’s “Description of the
Kingdom of Congo,”[1] drawn up from the notes of a Portuguese
sailor, Eduardo Lopez, and published in 1598. The tenth chapter of
this work is entitled “De Animalibus quæ in hac provincia
reperiuntur,” and contains a brief passage to the effect that “in the
Songan country, on the banks of the Zaire, there are multitudes of
apes, which afford great delight to the nobles by imitating human
gestures.” As this might apply to almost any kind of apes, I should
have thought little of it, had not the brothers De Bry, whose
engravings illustrate the work, thought fit, in their eleventh
“Argumentum,” to figure two of these “Simiæ magnatum deliciæ.” So
much of the plate as contains these apes is faithfully copied in the
woodcut (Fig. 1), and it will be observed that they are tail-less, long-
armed, and large-eared; and about the size of Chimpanzees. It may
be that these apes are as much figments of the imagination of the
ingenious brothers as the winged, two-legged, crocodile-headed
dragon which adorns the same plate; or, on the other hand, it may
be that the artists have constructed their drawings from some
essentially faithful description of a Gorilla or a Chimpanzee. And, in
either case, though these figures are worth a passing notice, the
oldest trustworthy and definite accounts of any animal of this kind
date from the 17th century, and are due to an Englishman.

Fig. 1.—Simiæ magnatum deliciæ.—De Bry, 1598.


The first edition of that most amusing old book, “Purchas his
Pilgrimage,” was published in 1613, and therein are to be found
many references to the statements of one whom Purchas terms
“Andrew Battell (my neere neighbour, dwelling at Leigh in Essex)
who served under Manuel Silvera Perera, Governor under the King of
Spaine, at his city of Saint Paul, and with him went farre into the
countrey of Angola”; and again, “my friend, Andrew Battle, who lived
in the kingdom of Congo many yeares,” and who, “upon some
quarell betwixt the Portugals (among whom he was a sergeant of a
band) and him, lived eight or nine moneths in the woodes.” From
this weather-beaten old soldier, Purchas was amazed to hear “of a
kinde of Great Apes, if they might so bee termed, of the height of a
man, but twice as bigge in feature of their limmes, with strength
proportionable, hairie all over, otherwise altogether like men and
women in their whole bodily shape.[2] They lived on such wilde fruits
as the trees and woods yielded, and in the night time lodged on the
trees.”
This extract is, however, less detailed and clear in its statements
than a passage in the third chapter of the second part of another
work—“Purchas his Pilgrimes,” published in 1625, by the same
author—which has been often, though hardly ever quite rightly,
cited. The chapter is entitled, “The strange adventures of Andrew
Battell, of Leigh in Essex, sent by the Portugals prisoner to Angola,
who lived there and in the adjioining regions neere eighteene
yeeres.” And the sixth section of this chapter is headed—“Of the
Provinces of Bongo, Calongo, Mayombe, Manikesocke, Motimbas: of
the Ape Monster Pongo, their hunting: Idolatries; and divers other
observations.”
“This province (Calongo) toward the east bordereth upon Bongo, and
toward the north upon Mayombe, which is nineteen leagues from Longo
along the coast.
“This province of Mayombe is all woods and groves, so overgrowne that a
man may travaile twentie days in the shadow without any sunne or heat.
Here is no kind of corne nor graine, so that the people liveth onely upon
plantanes and roots of sundrie sorts, very good; and nuts; nor any kinde
of tame cattell, nor hens.
“But they have great store of elephant’s flesh, which they greatly
esteeme, and many kinds of wild beasts; and great store of fish. Here is a
great sandy bay, two leagues to the northward of Cape Negro,[3] which is
the port of Mayombe. Sometimes the Portugals lade log-wood in this bay.
Here is a great river, called Banna: in the winter it hath no barre, because
the generall winds cause a great sea. But when the sunne hath his south
declination, then a boat may goe in; for then it is smooth because of the
raine. This river is very great, and hath many ilands and people dwelling
in them. The woods are so covered with baboones, monkies, apes and
parrots, that it will feare any man to travaile in them alone. Here are also
two kinds of monsters, which are common in these woods, and very
dangerous.
“The greatest of these two monsters is called Pongo in their language,
and the lesser is called Engeco. This Pongo is in all proportion like a man;
but that he is more like a giant in stature than a man; for he is very tall,
and hath a man’s face, hollow-eyed, with long haire upon his browes. His
face and eares are without haire, and his hands also. His bodie is full of
haire, but not very thicke; and it is of a dunnish colour.
“He differeth not from a man but in his legs; for they have no calfe. Hee
goeth alwaies upon his legs, and carrieth his hands clasped in the nape of
his necke when he goeth upon the ground. They sleepe in the trees, and
build shelters for the raine. They feed upon fruit that they find in the
woods, and upon nuts, for they eate no kind of flesh. They cannot speake,
and have no understanding more than a beast. The people of the
countrie, when they travaile in the woods make fires where they sleepe in
the night; and in the morning when they are gone, the Pongoes will come
and sit about the fire till it goeth out; for they have no understanding to
lay the wood together. They goe many together and kill many negroes
that travaile in the woods. Many times they fall upon the elephants which
come to feed where they be, and so beate them with their clubbed fists,
and pieces of wood, that they will runne roaring away from them. Those
Pongoes are never taken alive because they are so strong, that ten men
cannot hold one of them; but yet they take many of their young ones with
poisoned arrowes.
“The young Pongo hangeth on his mother’s belly with his hands fast
clasped about her, so that when the countrie people kill any of the females
they take the young one, which hangeth fast upon his mother.
“When they die among themselves, they cover the dead with great heaps
of boughs and wood, which is commonly found in the forest.”[4]

It does not appear difficult to identify the exact region of which


Battell speaks. Longo is doubtless the name of the place usually
spelled Loango on our maps. Mayombe still lies some nineteen
leagues northward from Loango, along the coast; and Cilongo or
Kilonga, Manikesocke, and Motimbas are yet registered by
geographers. The Cape Negro of Battell, however, cannot be the
modern Cape Negro in 16° S., since Loango itself is in 4° S. latitude.
On the other hand, the “great river called Banna” corresponds very
well with the “Camma” and “Fernand Vas,” of modern geographers,
which form a great delta on this part of the African coast.
Now this “Camma” country is situated about a degree and a-half
south of the Equator, while a few miles to the north of the line lies
the Gaboon, and a degree or so north of that, the Money River—
both well known to modern naturalists as localities where the largest
of man-like Apes has been obtained. Moreover, at the present day,
the word Engeco, or N’schego, is applied by the natives of these
regions to the smaller of the two great Apes which inhabit them; so
that there can be no rational doubt that Andrew Battell spoke of that
which he knew of his own knowledge, or, at any rate, by immediate
report from the natives of Western Africa. The “Engeco,” however, is
that “other monster” whose nature Battell “forgot to relate,” while
the name “Pongo”—applied to the animal whose characters and
habits are so fully and carefully described—seems to have died out,
at least in its primitive form and signification. Indeed, there is
evidence that not only in Battell’s time, but up to a very recent date,
it was used in a totally different sense from that in which he employs
it.
For example, the second chapter of Purchas’ work, which I have just
quoted, contains “A Description and Historicall Declaration of the
Golden Kingdom of Guinea, &c. &c. Translated from the Dutch, and
compared also with the Latin,” wherein it is stated (p. 986) that—
“The River Gaboon lyeth about fifteen miles northward from Rio de Angra,
and eight miles northward from Cape de Lope Gonsalvez (Cape Lopez),
and is right under the Equinoctial line, about fifteene miles from St.
Thomas, and is a great land, well and easily to be knowne. At the mouth
of the river there lieth a sand, three or foure fathoms deepe, whereon it
beateth mightily with the streame which runneth out of the river into the
sea. This river, in the mouth thereof, is at least four miles broad; but when
you are about the Iland called Pongo, it is not above two miles broad....
On both sides the river there standeth many trees.... The Iland called
Pongo, which hath a monstrous high hill.”

The French naval officers, whose letters are appended to the late M.
Isidore Geoff. Saint Hilaire’s excellent essay on the Gorilla,[5] note in
similar terms the width of the Gaboon, the trees that line its banks
down to the water’s edge, and the strong current that sets out of it.
They describe two islands in its estuary;—one low, called Perroquet;
the other high, presenting three conical hills, called Coniquet; and
one of them, M. Franquet, expressly states that, formerly, the Chief
of Coniquet was called Meni-Pongo, meaning thereby Lord of Pongo;
and that the N’Pongues (as, in agreement with Dr. Savage, he
affirms the natives call themselves) term the estuary of the Gaboon
itself N’Pongo.
It is so easy, in dealing with savages, to misunderstand their
applications of words to things, that one is at first inclined to suspect
Battell of having confounded the name of this region, where his
“greater monster” still abounds, with the name of the animal itself.
But he is so right about other matters (including the name of the
“lesser monster”) that one is loth to suspect the old traveller of
error; and, on the other hand, we shall find that a voyager of a
hundred years’ later date speaks of the name “Boggoe,” as applied
to a great Ape, by the inhabitants of quite another part of Africa—
Sierra Leone.
But I must leave this question to be settled by philologers and
travellers; and I should hardly have dwelt so long upon it except for
the curious part played by this word “Pongo” in the later history of
the man-like Apes.
The generation which succeeded Battell
saw the first of the man-like Apes which
was ever brought to Europe, or, at any
rate, whose visit found a historian. In the
third book of Tulpius’ “Observationes
Medicæ,” published in 1641, the 56th
chapter or section is devoted to what he
calls Satyrus indicus, “called by the
Indians Orang-autang, or Man-of-the-
Woods, and by the Africans Quoias
Morrou.” He gives a very good figure,
evidently from the life, of the specimen of
this animal, “nostra memoria ex Angolâ
delatum,” presented to Frederick Henry
Fig. 2.—The Orang of
Prince of Orange. Tulpius says it was as
Tulpius, 1641.
big as a child of three years old, and as
stout as one of six years: and that its back
was covered with black hair. It is plainly a young Chimpanzee.
In the meanwhile, the existence of other, Asiatic, man-like Apes
became known, but at first in a very mythical fashion. Thus Bontius
(1658) gives an altogether fabulous and ridiculous account and
figure of an animal which he calls “Orang-outang”; and though he
says, “vidi Ego cujus effigiem hic exhibeo,” the said effigies (see Fig.
6 for Hoppius’ copy of it) is nothing but a very hairy woman of rather
comely aspect, and with proportions and feet wholly human. The
judicious English anatomist, Tyson, was justified in saying of this
description by Bontius, “I confess I do mistrust the whole
representation.”
It is to the last mentioned writer, and his coadjutor Cowper, that we
owe the first account of a man-like ape which has any pretensions to
scientific accuracy and completeness. The treatise entitled, “Orang-
outang, sive Homo Sylvestris; or the Anatomy of a Pygmie compared
with that of a Monkey, an Ape, and a Man,” published by the Royal
Society in 1699, is, indeed, a work of remarkable merit, and has, in
some respects, served as a model to subsequent inquirers. This
“Pygmie,” Tyson tells us, “was brought from Angola, in Africa; but
was first taken a great deal higher up the country”; its hair “was of a
coal-black colour, and strait,” and “when it went as a quadruped on
all four, ’twas awkwardly; not placing the palm of the hand flat to
the ground, but it walk’d upon its knuckles, as I observed it to do
when weak and had not strength enough to support its
body.”—“From the top of the head to the heel of the foot, in a strait
line, it measured twenty-six inches.”

Figs. 3 and 4.—The “Pygmie” reduced from Tyson’s figures 1 and 2,


1699.

These characters, even without Tyson’s good figures (Figs. 3 and 4),
would have been sufficient to prove his “Pygmie” to be a young
Chimpanzee. But the opportunity of examining the skeleton of the
very animal Tyson anatomised having most unexpectedly presented
itself to me, I am able to bear independent testimony to its being a
veritable Troglodytes niger,[6] though still very young. Although fully
appreciating the resemblances between his Pygmie and Man, Tyson
by no means overlooked the differences between the two, and he
concludes his memoir by summing up first, the points in which “the
Ourang-outang or Pygmie more resembled a Man than Apes and
Monkeys do,” under forty-seven distinct heads; and then giving, in
thirty-four similar brief paragraphs, the respects in which “the
Ourang-outang or Pygmie differ’d from a Man and resembled more
the Ape and Monkey kind.”
After a careful survey of the literature of the subject extant in his
time, our author arrives at the conclusion that his “Pygmie” is
identical neither with the Orangs of Tulpius and Bontius, nor with the
Quoias Morrou of Dapper (or rather of Tulpius), the Barris of d’Arcos,
nor with the Pongo of Battell; but that it is a species of ape probably
identical with the Pygmies of the Ancients, and, says Tyson, though
it “does so much resemble a Man in many of its parts, more than
any of the ape kind, or any other animal in the world, that I know
of: yet by no means do I look upon it as the product of a mixt
generation—’tis a Brute-Animal sui generis, and a particular species
of Ape.”
The name of “Chimpanzee,” by which one of the African Apes is now
so well known, appears to have come into use in the first half of the
eighteenth century, but the only important addition made, in that
period, to our acquaintance with the man-like Apes of Africa is
contained in “A New Voyage to Guinea,” by William Smith, which
bears the date 1744.
In describing the animals of Sierra Leone, p. 51, this writer says:—
“I shall next describe a strange sort of animal, called by the white men in
this country Mandrill,[7] but why it is so called I know not, nor did I ever
hear the name before, neither can those who call them so tell, except it
be for their near resemblance of a human creature, though nothing at all
like an Ape. Their bodies, when full grown, are as big in circumference as
a middle-sized man’s—their legs much shorter, and their feet larger; their
arms and hands in proportion. The head is monstrously big, and the face
broad and flat, without any other hair but the eyebrows; the nose very
small, the mouth wide, and the lips thin. The face, which is covered by a
white skin, is monstrously ugly, being all over wrinkled as with old age;
the teeth broad and yellow; the hands have no more hair than the face,
but the same white skin, though all the rest of the body is covered with
long black hair, like a bear. They never go upon all fours, like apes; but
cry, when vexed or teased, just like children....

Fig. 5.—Facsimile of William Smith’s figure of the “Mandrill,” 1744.

“When I was at Sherbro, one Mr. Cummerbus, whom I shall have occasion
hereafter to mention, made me a present of one of these strange animals,
which are called by the natives Boggoe: it was a she-cub, of six months’
age, but even then larger than a Baboon. I gave it in charge to one of the
slaves, who knew how to feed and nurse it, being a very tender sort of
animal; but whenever I went off the deck the sailors began to teaze it—
some loved to see its tears and hear it cry; others hated its snotty-nose;
one who hurt it, being checked by the negro that took care of it, told the
slave he was very fond of his country-woman, and asked him if he should
not like her for a wife? To which the slave very readily replied, ‘No, this no
my wife; this a white woman—this fit wife for you.’ This unlucky wit of the
negro’s, I fancy, hastened its death, for next morning it was found dead
under the windlass.”

William Smith’s “Mandrill,” or “Boggoe,” as his description and figure


testify, was, without doubt, a Chimpanzee.

Fig. 6.—The Anthropomorpha of Linnæus.

Linnæus knew nothing, of his own observation, of the man-like Apes


of either Africa or Asia, but a dissertation by his pupil Hoppius in the
“Amœnitates Academicæ” (VI. “Anthropomorpha”) may be regarded
as embodying his views respecting these animals.
The dissertation is illustrated by a plate, of which the accompanying
woodcut, Fig. 6, is a reduced copy. The figures are entitled (from left
to right) 1. Troglodyta Bontii; 2. Lucifer Aldrovandi; 3. Satyrus Tulpii;
4. Pygmæus Edwardi. The first is a bad copy of Bontius’ fictitious
“Ourang-outang,” in whose existence, however, Linnæus appears to
have fully believed; for in the standard edition of the “Systema
Naturæ,” it is enumerated as a second species of Homo; “H.
nocturnus.” Lucifer Aldrovandi is a copy of a figure in Aldrovandus,
“De Quadrupedibus digitatis viviparis,” Lib. 2, p. 249 (1645), entitled
“Cercopithecus formæ raræ Barbilius vocatus et originem a china
ducebat.” Hoppius is of opinion that this may be one of that cat-
tailed people, of whom Nicolaus Köping affirms that they eat a boat’s
crew, “gubernator navis” and all! In the “Systema Naturæ” Linnæus
calls it in a note, Homo caudatus, and seems inclined to regard it as
a third species of man. According to Temminck, Satyrus Tulpii is a
copy of the figure of a Chimpanzee published by Scotin in 1738,
which I have not seen. It is the Satyrus indicus of the “Systema
Naturæ,” and is regarded by Linnæus as possibly a distinct species
from Satyrus sylvestris. The last, named Pygmæus Edwardi, is
copied from the figure of a young “Man of the Woods,” or true
Orang-Utan, given in Edwards “Gleanings of Natural History” (1758).
Buffon was more fortunate than his great rival. Not only had he the
rare opportunity of examining a young Chimpanzee in the living
state, but he became possessed of an adult Asiatic man-like Ape—
the first and the last adult specimen of any of these animals brought
to Europe for many years. With the valuable assistance of
Daubenton, Buffon gave an excellent description of this creature,
which, from its singular proportions, he termed the long-armed Ape,
or Gibbon. It is the modern Hylobates lar.
Thus when, in 1766, Buffon wrote the fourteenth volume of his great
work, he was personally familiar with the young of one kind of
African man-like Ape, and with the adult of an Asiatic species—while
the Orang-Utan and the Mandrill of Smith were known to him by
report. Furthermore, the Abbé Prevost had translated a good deal of
Purchas’ Pilgrims into French, in his “Histoire générale des Voyages”
(1748), and there Buffon found a version of Andrew Battell’s account
of the Pongo and the Engeco. All these data Buffon attempts to weld
together into harmony in his chapter entitled “Les Orang-outangs ou
le Pongo et le Jocko.” To this title the following note is appended:—
“Orang-outang nom de cet animal aux Indes orientales: Pongo nom de cet
animal à Lowando Province de Congo.
“Jocko, Enjocko, nom de cet animal à Congo que nous avons adopté. En
est l’article que nous avons retranché.”
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like