100% found this document useful (2 votes)
70 views

Fundamentals Of Python: Data Structures 2nd Edition Kenneth A. Lambert - The latest ebook is available for instant download now

The document promotes various eBooks available for download at textbookfull.com, including titles on Python programming, data structures, and algorithms. It highlights the convenience of accessing digital formats like PDF, ePub, and MOBI for reading on multiple devices. Additionally, it contains copyright information and a table of contents for the book 'Fundamentals of Python: Data Structures, 2nd Edition' by Kenneth A. Lambert.

Uploaded by

jakuzaahiawu
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
100% found this document useful (2 votes)
70 views

Fundamentals Of Python: Data Structures 2nd Edition Kenneth A. Lambert - The latest ebook is available for instant download now

The document promotes various eBooks available for download at textbookfull.com, including titles on Python programming, data structures, and algorithms. It highlights the convenience of accessing digital formats like PDF, ePub, and MOBI for reading on multiple devices. Additionally, it contains copyright information and a table of contents for the book 'Fundamentals of Python: Data Structures, 2nd Edition' by Kenneth A. Lambert.

Uploaded by

jakuzaahiawu
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

Explore the full ebook collection and download it now at textbookfull.

com

Fundamentals Of Python: Data Structures 2nd


Edition Kenneth A. Lambert

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

OR CLICK HERE

DOWLOAD EBOOK

Browse and Get More Ebook Downloads Instantly at https://textbookfull.com


Click here to visit textbookfull.com and download textbook now
Your digital treasures (PDF, ePub, MOBI) await
Download instantly and pick your perfect format...

Read anywhere, anytime, on any device!

Fundamentals of Python: First Programs, 2nd Edition


Kenneth A. Lambert

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

textbookfull.com

Data Structures & Algorithms in Python John Canning

https://textbookfull.com/product/data-structures-algorithms-in-python-
john-canning/

textbookfull.com

Data Science Fundamentals for Python and MongoDB 1st


Edition David Paper

https://textbookfull.com/product/data-science-fundamentals-for-python-
and-mongodb-1st-edition-david-paper/

textbookfull.com

Fundamentals of Structural Analysis Kenneth M. Leet

https://textbookfull.com/product/fundamentals-of-structural-analysis-
kenneth-m-leet/

textbookfull.com
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/

textbookfull.com

Data Structures with C Programming 2nd Edition Anil Kumar


Yadav

https://textbookfull.com/product/data-structures-with-c-
programming-2nd-edition-anil-kumar-yadav/

textbookfull.com

Python for Data Science 2nd Edition John Paul Mueller

https://textbookfull.com/product/python-for-data-science-2nd-edition-
john-paul-mueller/

textbookfull.com

Matplotlib for Python Developers Effective techniques for


data visualization with Python 2nd Edition Yim

https://textbookfull.com/product/matplotlib-for-python-developers-
effective-techniques-for-data-visualization-with-python-2nd-edition-
yim/
textbookfull.com

Interpreting LISP: Programming and Data Structures 2nd


Edition Gary D. Knott (Auth.)

https://textbookfull.com/product/interpreting-lisp-programming-and-
data-structures-2nd-edition-gary-d-knott-auth/

textbookfull.com
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:
Data STRUCTURES

Kenneth A. Lambert

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, 2014 Cengage Learning, Inc.
Data ­Structures, Second Edition
Unless otherwise noted, all content is © Cengage.
Kenneth A. Lambert
ALL RIGHTS RESERVED. No part of this work covered by the
­copyright herein may be reproduced or distributed in any form or
SVP, GM Skills & Global Product by any means, except as permitted by U.S. copyright law, without
Management: Jonathan Lau the prior written permission of the copyright owner.

Product Team Manager: Kristin McNary

Product Manager: Chris Shortt For product information and technology assistance, c­ ontact us
at Cengage Customer & Sales Support,
Product Assistant: Thomas Benedetto
1-800-354-9706 or support.cengage.com.
Executive Director, Content Design: Marah
Bellegarde
For permission to use material from this text or product,
Director, Learning Design: Leigh Hefferon submit all requests online at
www.cengage.com/permissions.
Learning Designer: Kate Mason

Vice President, Strategic Marketing Services:


Jennifer Baker Library of Congress Control Number: 2018956860

Marketing Director: Michele McTighe

Associate Marketing Manager: Cassie Cloutier ISBN: 978-0-357-12275-4

Director, Content Delivery: Patty Stephan


Cengage
Senior Content Manager: Michelle Ruelos
20 Channel Center Street
Cannistraci
Boston, MA 02210
Designer: Erin K. Griffin
USA
Cover image: Digital_Art/Shutterstock.com
Cengage is a leading provider of customized learning solutions with
Service Provider/Compositor: SPi Global employees residing in nearly 40 different countries and sales in
more than 125 countries around the world. Find your local repre-
sentative at www.cengage.com.

Cengage products are represented in Canada by


Nelson Education, Ltd.

To learn more about Cengage platforms and services, register or


access your online learning solution, or purchase m
­ aterials for your
course, visit www.cengage.com.

Notice to the Reader


Publisher does not warrant or guarantee any of the products described herein or perform any independent analysis in c­ onnection
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: 2018

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 �������������������������������������������������� xi

CHAPTER 1 B as ic Pyt h o n Programmi ng ��������������������������� 1


Basic Program Elements ��������������������������������������������������� 2
Programs and Modules��������������������������������������������������� 2
An Example Python Program: Guessing a Number��������������� 2
Editing, Compiling, and Running Python Programs��������������� 3
Program Comments ������������������������������������������������������� 4
Lexical Elements������������������������������������������������������������ 4
Spelling and Naming Conventions ������������������������������������ 4
Syntactic Elements��������������������������������������������������������� 5
Literals ������������������������������������������������������������������������ 5
Operators and Expressions ��������������������������������������������� 6
Function Calls ��������������������������������������������������������������� 7
The print Function������������������������������������������������������� 7
The input Function ��������������������������������������������������������� 7
Type Conversion Functions and Mixed-Mode Operations ������ 7
Optional and Keyword Function Arguments ������������������������ 7
Variables and Assignment Statements ������������������������������ 8
Python Data Typing��������������������������������������������������������� 9
import Statements ������������������������������������������������������� 9
Getting Help on Program Components ������������������������������ 9
Control Statements ���������������������������������������������������������10
Conditional Statements��������������������������������������������������10
Using if __name__ == "__main__"�����������������������������11
Loop Statements�����������������������������������������������������������12
Strings and Their Operations ��������������������������������������������12
Operators��������������������������������������������������������������������13
Formatting Strings for Output�����������������������������������������14
Objects and Method Calls�����������������������������������������������15
Built-In Python Collections and Their Operations��������������������16
Lists ��������������������������������������������������������������������������16
Tuples ������������������������������������������������������������������������17

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 

Loops Over Sequences��������������������������������������������������17


Dictionaries �����������������������������������������������������������������18
Searching for a Value�����������������������������������������������������18
Pattern Matching with Collections �����������������������������������18
Creating New Functions ���������������������������������������������������19
iv Function Definitions ������������������������������������������������������19
Recursive Functions������������������������������������������������������20
Nested Function Definitions��������������������������������������������22
Higher-Order Functions��������������������������������������������������23
Creating Anonymous Functions with lambda ���������������������24
Catching Exceptions ��������������������������������������������������������24
Files and Their Operations ������������������������������������������������25
Text File Output������������������������������������������������������������26
Writing Numbers to a Text File ���������������������������������������26
Reading Text from a Text File �����������������������������������������27
Reading Numbers from a File �����������������������������������������28
Reading and Writing Objects with pickle ������������������������29
Creating New Classes ������������������������������������������������������30

CHAPTER 2 An Over view o f Col l ecti ons ������������������������� 37


Collection Types��������������������������������������������������������������38
Linear Collections ��������������������������������������������������������38
Hierarchical Collections��������������������������������������������������39
Graph Collections ���������������������������������������������������������39
Unordered Collections���������������������������������������������������40
Sorted Collections��������������������������������������������������������40
A Taxonomy of Collection Types��������������������������������������40
Operations on Collections��������������������������������������������������41
Fundamental Operations on All Collection Types�����������������41
Type Conversion�����������������������������������������������������������43
Cloning and Equality �����������������������������������������������������43
Iterators and Higher-Order Functions�����������������������������������44
Implementations of Collections������������������������������������������44

CHAPTER 3 Search in g , ­S o r ti ng, and Compl ex i ty Anal y si s��� 49


Measuring the Efficiency of Algorithms��������������������������������50
Measuring the Run Time of an Algorithm ��������������������������50
Counting Instructions�����������������������������������������������������53
Measuring the Memory Used by an Algorithm��������������������55
Complexity Analysis ���������������������������������������������������������55
Orders of Complexity�����������������������������������������������������56
Big-O Notation��������������������������������������������������������������57
The Role of the Constant of Proportionality�����������������������58
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

Search Algorithms �����������������������������������������������������������59


Search for the Minimum ������������������������������������������������59
Sequential Search of a List ��������������������������������������������60
Best-Case, Worst-Case, and Average-Case Performance�����60
Binary Search of a Sorted List ���������������������������������������61
Comparing Data Items ��������������������������������������������������62 v
Basic Sort Algorithms ������������������������������������������������������64
Selection Sort��������������������������������������������������������������64
Bubble Sort �����������������������������������������������������������������65
Insertion Sort ��������������������������������������������������������������67
Best-Case, Worst-Case, and Average-Case Performance
Revisited��������������������������������������������������������������������68
Faster Sorting��������������������������������������������������������������69
Overview of Quicksort ���������������������������������������������������70
Merge Sort������������������������������������������������������������������74
An Exponential Algorithm: Recursive Fibonacci ��������������������77
Converting Fibonacci to a Linear Algorithm�����������������������78

CHAPTER 4 Ar r ays an d Linked Structures ���������������������� 89


The Array Data Structure��������������������������������������������������90
Random Access and Contiguous Memory��������������������������92
Static Memory and Dynamic Memory��������������������������������93
Physical Size and Logical Size ���������������������������������������94
Operations on Arrays��������������������������������������������������������94
Increasing the Size of an Array���������������������������������������95
Decreasing the Size of an Array��������������������������������������95
Inserting an Item into an Array That Grows �����������������������96
Removing an Item from an Array��������������������������������������97
Complexity Trade-Off: Time, Space, and Arrays�����������������98
Two-Dimensional Arrays (Grids) �����������������������������������������99
Processing a Grid������������������������������������������������������� 100
Creating and Initializing a Grid��������������������������������������� 100
Defining a Grid Class��������������������������������������������������� 101
Ragged Grids and Multidimensional Arrays ��������������������� 101
Linked Structures ���������������������������������������������������������� 102
Singly Linked Structures and Doubly Linked Structures ���� 103
Noncontiguous Memory and Nodes ������������������������������� 104
Defining a Singly Linked Node Class������������������������������ 106
Using the Singly Linked Node Class ������������������������������ 106
Operations on Singly Linked Structures ���������������������������� 108
Traversal ������������������������������������������������������������������ 108
Searching������������������������������������������������������������������ 109
Replacement ������������������������������������������������������������� 110
Inserting at the Beginning��������������������������������������������� 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 

Inserting at the End ���������������������������������������������������� 111


Removing at the Beginning ������������������������������������������ 112
Removing at the End��������������������������������������������������� 113
Inserting at Any Position���������������������������������������������� 114
Removing at Any Position��������������������������������������������� 116
vi Complexity Trade-Off: Time, Space, and Singly Linked
Structures ��������������������������������������������������������������� 116
Variations on a Link ������������������������������������������������������� 118
A Circular Linked Structure with a Dummy Header Node��� 118
Doubly Linked Structures��������������������������������������������� 119

CHAPTER 5  In t er f aces , ­I m pl ementati ons,


an d Po lym o r phi sm���������������������������������� 126
Developing an Interface ������������������������������������������������� 127
Designing the Bag Interface������������������������������������������ 127
Specifying Arguments and Return Values������������������������ 129
Constructors and Implementing Classes ��������������������������� 130
Preconditions, Postconditions, Exceptions,
and Documentation ��������������������������������������������������� 131
Coding an Interface in Python��������������������������������������� 132
Developing an Array-Based Implementation������������������������ 134
Choose and Initialize the Data Structures������������������������ 134
Complete the Easy Methods First ��������������������������������� 135
Complete the Iterator ������������������������������������������������� 136
Complete the Methods That Use the Iterator ������������������ 137
The in Operator and the __contains__ Method������������ 137
Complete the remove Method��������������������������������������� 138
Developing a Link-Based Implementation��������������������������� 139
Initialize the Data Structures ���������������������������������������� 139
Complete the Iterator ������������������������������������������������� 140
Complete the Methods clear and add��������������������������� 140
Complete the Method remove��������������������������������������� 141
Run-Time Performance of the Two Bag Implementations ������ 142
Testing the Two Bag Implementations ������������������������������� 142
Diagramming the Bag Resource with UML ������������������������� 144

CHAPTER 6 In h er it an ce an d Abstract Cl asses��������������� 148


Using Inheritance to Customize an Existing Class��������������� 149
Subclassing an Existing Class��������������������������������������� 150
Revising the __init__ Method ������������������������������������ 150
Adding a New __contains__ Method ��������������������������� 152
Modifying the Existing add Method ������������������������������� 152
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

Modifying the Existing __add__ Method ������������������������ 153


Run-Time Performance of ArraySortedBag ������������������ 153
A Note on Class Hierarchies in Python ��������������������������� 154
Using Abstract Classes to Eliminate Redundant Code ��������� 155
Designing an AbstractBag Class��������������������������������� 155
Redoing the __init__ Method in AbstractBag ������������ 157 vii
Modifying the Subclasses of AbstractBag��������������������� 157
Generalizing the __add__ Method in AbstractBag��������� 158
An Abstract Class for All Collections��������������������������������� 159
Integrating AbstractCollection into the Collection
Hierarchy ���������������������������������������������������������������� 159
Using Two Iterators in the __eq__ Method ��������������������� 161
A Professional-Quality Framework of Collections ���������������� 162

CHAPTER 7 St ack s ������������������������������������������������� 167


Overview of Stacks��������������������������������������������������������� 168
Using a Stack ��������������������������������������������������������������� 169
The Stack Interface ���������������������������������������������������� 169
Instantiating a Stack ��������������������������������������������������� 170
Example Application: Matching Parentheses ������������������� 171
Three Applications of Stacks������������������������������������������� 174
Evaluating Arithmetic Expressions��������������������������������� 174
Evaluating Postfix Expressions ������������������������������������� 175
Converting Infix to Postfix ������������������������������������������� 176
Backtracking ������������������������������������������������������������� 179
Memory Management��������������������������������������������������� 181
Implementations of Stacks ��������������������������������������������� 184
Test Driver ���������������������������������������������������������������� 184
Adding Stacks to the Collection Hierarchy���������������������� 185
Array Implementation��������������������������������������������������� 186
Linked Implementation ������������������������������������������������ 187
The Role of the Abstract Stack Class ���������������������������� 190
Time and Space Analysis of the Two Implementations ������ 191

C HAPTER 8 Qu eu es ������������������������������������������������� 205


Overview of Queues ������������������������������������������������������� 206
The Queue Interface and Its Use��������������������������������������� 207
Two Applications of Queues��������������������������������������������� 210
Simulations ��������������������������������������������������������������� 210
Round-Robin CPU Scheduling ��������������������������������������� 212
Implementations of Queues��������������������������������������������� 213
A Linked Implementation of Queues������������������������������� 213
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 

An Array Implementation ��������������������������������������������� 215


Time and Space Analysis for the Two Implementations������ 217
Priority Queues ������������������������������������������������������������� 226

CHAPTER 9 Lis t s ���������������������������������������������������� 239


viii Overview of Lists ���������������������������������������������������������� 240
Using Lists ������������������������������������������������������������������� 240
Index-Based Operations������������������������������������������������ 241
Content-Based Operations ������������������������������������������� 242
Position-Based Operations ������������������������������������������� 242
Interfaces for Lists������������������������������������������������������ 247
Applications of Lists ������������������������������������������������������ 249
Heap-Storage Management ������������������������������������������ 249
Organization of Files on a Disk ������������������������������������� 250
Implementation of Other Collections������������������������������ 252
List Implementations������������������������������������������������������ 252
The Role of the AbstractList Class ��������������������������� 252
An Array-Based Implementation ������������������������������������ 254
A Linked Implementation ��������������������������������������������� 255
Time and Space Analysis for the Two Implementations������ 258
Implementing a List Iterator��������������������������������������������� 260
Role and Responsibilities of a List Iterator ��������������������� 260
Setting Up and Instantiating a List Iterator Class������������� 261
The Navigational Methods in the List Iterator ������������������ 262
The Mutator Methods in the List Iterator ������������������������ 263
Design of a List Iterator for a Linked List������������������������ 264
Time and Space Analysis of List Iterator
Implementations ������������������������������������������������������� 265
Recursive List Processing ���������������������������������������������� 270
Basic Operations on a Lisp-Like List������������������������������ 271
Recursive Traversals of a Lisp-Like List ������������������������� 272
Building a Lisp-Like List������������������������������������������������ 273
The Internal Structure of a Lisp-Like List������������������������ 275
Printing Lisp-Like Lists in IDLE with __repr__���������������� 276
Lists and Functional Programming��������������������������������� 277

CHAPTER 10 Trees ���������������������������������������������������� 282


An Overview of Trees������������������������������������������������������ 283
Tree Terminology�������������������������������������������������������� 283
General Trees and Binary Trees ������������������������������������ 284
Recursive Definitions of Trees��������������������������������������� 285
Why Use a Tree?������������������������������������������������������������ 286
The Shape of Binary Trees ���������������������������������������������� 288

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

Binary Tree Traversals ��������������������������������������������������� 291


Preorder Traversal������������������������������������������������������ 291
Inorder Traversal��������������������������������������������������������� 291
Postorder Traversal ���������������������������������������������������� 292
Level Order Traversal��������������������������������������������������� 292
Three Common Applications of Binary Trees ���������������������� 293 ix
Heaps����������������������������������������������������������������������� 293
Binary Search Trees ��������������������������������������������������� 293
Expression Trees��������������������������������������������������������� 295
Developing a Binary Search Tree ������������������������������������� 297
The Binary Search Tree Interface ���������������������������������� 297
Data Structure for the Linked Implementation������������������ 299
Complexity Analysis of Binary Search Trees ������������������� 304
Recursive Descent Parsing and Programming
Languages������������������������������������������������������������������ 304
Introduction to Grammars��������������������������������������������� 305
Recognizing, Parsing, and Interpreting Sentences
in a Language ���������������������������������������������������������� 306
Lexical Analysis and the Scanner ���������������������������������� 307
Parsing Strategies������������������������������������������������������ 307
An Array Implementation of Binary Trees��������������������������� 313
Implementing Heaps ������������������������������������������������������ 315

CHAPTER 11 Set s an d Dict ionari es������������������������������� 322


Using Sets ������������������������������������������������������������������� 323
The Python Set Class������������������������������������������������������ 324
A Sample Session with Sets������������������������������������������ 325
Applications of Sets ��������������������������������������������������� 325
Relationship Between Sets and Bags������������������������������ 325
Relationship Between Sets and Dictionaries ������������������� 326
Implementations of Sets���������������������������������������������� 326
Array-Based and Linked Implementations of Sets ��������������� 326
The AbstractSet Class ��������������������������������������������� 327
The ArraySet Class��������������������������������������������������� 328
Using Dictionaries ��������������������������������������������������������� 329
Array-Based and Linked Implementations of Dictionaries������ 330
The Entry Class��������������������������������������������������������� 330
The AbstractDict Class ������������������������������������������� 331
The ArrayDict Class������������������������������������������������� 333
Complexity Analysis of the Array-Based and Linked
Implementations of Sets and Dictionaries��������������������� 334
Hashing Strategies��������������������������������������������������������� 335

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 

The Relationship of Collisions to Density������������������������ 336


Hashing with Nonnumeric Keys ������������������������������������� 337
Linear Probing������������������������������������������������������������ 339
Quadratic Probing ������������������������������������������������������ 340
Chaining ������������������������������������������������������������������� 341
x Complexity Analysis ���������������������������������������������������� 342
Hashing Implementation of Sets��������������������������������������� 349
Hashing Implementation of Dictionaries ���������������������������� 352
Sorted Sets and Dictionaries ������������������������������������������ 354

CHAPTER 12 Gr aph s ������������������������������������������������� 359


Why Use Graphs? ���������������������������������������������������������� 360
Graph Terminology��������������������������������������������������������� 360
Representations of Graphs ��������������������������������������������� 364
Adjacency Matrix��������������������������������������������������������� 365
Adjacency List������������������������������������������������������������ 366
Analysis of the Two Representations������������������������������ 367
Further Run-Time Considerations ���������������������������������� 368
Graph Traversals������������������������������������������������������������ 369
A Generic Traversal Algorithm��������������������������������������� 369
Breadth-First and Depth-First Traversals������������������������� 370
Graph Components������������������������������������������������������ 372
Trees Within Graphs������������������������������������������������������� 373
Spanning Trees and Forests������������������������������������������ 373
Minimum Spanning Tree����������������������������������������������� 373
Algorithms for Minimum Spanning Trees ������������������������ 373
Topological Sort������������������������������������������������������������ 376
The Shortest-Path Problem ��������������������������������������������� 377
Dijkstra’s Algorithm ���������������������������������������������������� 377
The Initialization Step ������������������������������������������������� 377
The Computation Step ������������������������������������������������ 379
Representing and Working with Infinity��������������������������� 380
Analysis��������������������������������������������������������������������� 380
Floyd’s Algorithm ������������������������������������������������������� 380
Analysis��������������������������������������������������������������������� 382
Developing a Graph Collection ���������������������������������������� 382
Example Use of the Graph Collection����������������������������� 383
The Class LinkedDirectedGraph������������������������������� 384
The Class LinkedVertex ������������������������������������������� 388
The Class LinkedEdge������������������������������������������������ 390

Glo s s ar y �����������������������������������������������������401

In dex ���������������������������������������������������� 410


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
xi

Welcome to Fundamentals of Python: Data Structures, 2nd Edition. This text is intended
for a second semester course in programming and problem solving with data structures. It
covers the material taught in a typical Computer Science 2 course (CS2) at the undergradu-
ate level. Although this book uses the Python programming language, you need only have a
basic knowledge of programming in a high-level programming language before beginning
Chapter 1.

What You’ll Learn


The book covers four 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 to solve
problems with computers. You’ll review these core topics in the Python program-
ming language and employ 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. You’ll
be introduced to the fundamental principles of OOP so that you can apply them
­successfully. Unlike other textbooks, this book helps you develop a professional-
quality framework of collection classes to illustrate these principles.
3. Data structures—Most useful programs rely on data structures to solve prob-
lems. At the most concrete level, data structures include arrays and various types
of linked structures. You’ll use these data structures to implement various types of
collection structures, such as stacks, queues, lists, trees, bags, sets, dictionaries, and
graphs. You’ll also learn to use complexity analysis to evaluate the space/time trade-
offs of different implementations of these collections.
4. Software development life cycle—Rather than isolate software development tech-
niques 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.

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 fa c e Why Python?

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 are
then expected to move quickly into topics like software development, complexity analysis,
xii
and data structures that, 30 years ago, were relegated to advanced courses. In addition,
the ascent of object-oriented programming as the dominant paradigm has led instructors
and textbook authors to bring powerful, industrial-strength programming languages such
as C++ and Java into 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 con-
cepts as well as the syntax of a programming language.
This book uses the Python programming language as a way of making the second course
in 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, you can spend less time dealing with the syntax of a programming
­language 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 easy for beginners to write simple programs in Python. Python
also includes all 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, especially in the second course in computer science
•• Python is highly interactive. You can enter expressions and statements at an interpreter’s
prompts to try out experimental code and receive immediate feedback. You can also
compose longer code segments and save them in script files to be loaded and run as
modules or stand-alone applications.
•• Python is general purpose. In today’s context, this means that the language includes
resources for contemporary applications, including media computing and web
services.
•• Python is free and is in widespread use in the industry. You can download Python to run
on a variety of devices. There is a large Python user community, and expertise in Python
programming has great resume value.
To summarize these benefits, Python is a comfortable and flexible vehicle for ­expressing
ideas about computation, both for beginners and for experts. If you learn these ideas well
in the first year, you should have no problems making a quick transition to other lan-
guages needed for courses later in the curriculum. Most importantly, you will spend less
time staring at a computer screen and more time thinking about interesting problems
to solve.
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 this Book P r e fa c e

Organization of this Book


The approach in this book is easygoing, with each new concept introduced only when it is
needed.
Chapter 1 provides a review of the features of Python programming that are needed to begin
a second course in programming and problem solving in Python. The content of this chapter xiii
is organized so that you can skim it quickly if you have experience in Python programming,
or you can dig a bit deeper to get up to speed in the language if you are new to Python.
Chapters 2 through 12 covers the major topics in a typical CS2 course, especially the specifica-
tion, implementation, and application of abstract data types, with the collection types as the
primary vehicle and focus. Along the way, you will be thoroughly exposed to object-oriented
programming techniques and the elements of good software design. Other important CS2 topics
include recursive processing of data, search and sort algorithms, and the tools used in software
development, such as complexity analysis and graphical notations (UML) to document designs.
Chapter 2 introduces the concept of an abstract data type (ADT) and provides an overview
of various categories of collection ADTs.
Chapters 3 and 4 explore the data structures used to implement most collections and the
tools for analyzing their performance trade-offs. Chapter 3 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 algorithms and data structures, using search and
sort algorithms as examples. Chapter 4 covers the details of processing arrays and linear
linked structures, the concrete data structures used to implement most collections. You’ll
learn the underlying models of computer memory that support arrays and linked structures
and the time/space trade-offs that they entail.
Chapters 5 and 6 shift the focus to the principles of object-oriented design. These principles
are used to organize a professional-quality framework of collection classes that will be cov-
ered in detail in later chapters.
Chapter 5 is concerned with the critical difference between interface and implementation.
A single interface and several implementations of a bag collection are developed as a first
example. Emphasis is placed on the inclusion of conventional methods in an interface, to
allow different types of collections to collaborate in applications. For example, one such
method creates an iterator, which allows you to traverse any collection with a simple loop.
Other topics covered in this chapter include polymorphism and information hiding, which
directly stem from the difference between interface and implementation.
Chapter 6 shows how class hierarchies can reduce the amount of redundant code in an object-
oriented software system. The related concepts of inheritance, dynamic binding of method
calls, and abstract classes are introduced here and used throughout the remaining chapters.
Armed with these concepts and principles, you’ll then be ready to consider the other major
collection ADTs, which form the subject of Chapters 7 through 12.
Chapters 7 through 9 present the linear collections, stacks, queues, and lists. Each collec-
tion is viewed first from the perspective of its users, who are aware only of an interface and
a set of performance characteristics possessed by a chosen implementation. The use of each
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 fa c e Special Features

collection is illustrated with one or more applications, and then several implementations
are developed, and their performance trade-offs are analyzed.
Chapters 10 through 12 present advanced data structures and algorithms as a transition to
later courses in computer science. Chapter 10 discusses various tree structures, including
binary search trees, heaps, and expression trees. Chapter 11 examines the ­implementation
xiv of the unordered collections, bags, sets, and dictionaries, using hashing strategies.
­Chapter 12 introduces graphs and graph-processing algorithms.
As mentioned earlier, this book is unique in presenting a professional-quality framework of
collection types. Instead of encountering a series of apparently unrelated collections, you
will explore the place of each collection in an integrated whole. This approach allows you
to see what the collection types have in common as well as what makes each one unique.
At the same time, you will be exposed to a realistic use of inheritance and class hierarchies,
topics in object-oriented software design that are difficult to motivate and exemplify at this
level of the curriculum.

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 development 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 programming projects.
•• Chapter summaries—Each chapter after the first one ends with a summary of the
major concepts covered in the chapter.
•• Key terms—When a new term is introduced in the text, it appears in bold face.
­Definitions of the key terms are also collected in a glossary.
•• Exercises—Most major sections of each chapter after the first one end with exercise
questions that reinforce the reading by asking basic questions about the material in the
section. After Chapter 2, each chapter ends with review questions.
•• Programming projects—Each chapter ends with a set of programming projects of
varying difficulty.

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, comments, and function, method, and class names. Learning
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 P r e fa c e

objectives have been added to the beginning of each chapter. Several new figures have been
added to illustrate concepts, and many programming projects have been added or reworked.
A new section on iterators and higher-order functions has been added to Chapter 2. Finally,
a new section on Lisp-like lists, recursive list processing, and functional programming has
been added to Chapter 9.
xv
Instructor Resources
MindTap
MindTap activities for Fundamentals of Python: Data Structures 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. H
­ ands-on
coding labs provide real-life application and practice. Readings and dynamic visualizations
support the lecture, while a post-course assessment measures exactly how much a 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/.

Instructor Companion Site


The following teaching tools are available for download at the Companion Site for this text.
Go to instructor.cengage.com and sign in to the instructor account. Search for the textbook
and add the text to the instructor dashboard.
•• 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 Topics,
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.
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 fa c e Dedication

•• 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.cengage.com. If an input file is
needed to run a program, it is included with the source code.

xvi

The first-of-its-kind digital subscription designed specially to lower costs. Students get total
access to everything Cengage has to offer on demand—in one place. That’s 20,000 eBooks,
2,300 digital learning products, and dozens of study tools across 70 disciplines and over
675 courses. Currently available in select markets. Details at www.cengage.com/unlimited

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]. A listing of errata, should they be found, as well as other informa-
tion about the book, will be posted on the website http://home.wlu.edu/~lambertk/python/.

Acknowledgments
I would like to thank my friend, Martin Osborne, for many years of advice, friendly
­criticism, and encouragement on several of my book projects.
I would also like to thank my students in Computer Science 112 at Washington and Lee
University for classroom testing this book over several semesters.
Finally, I would like to thank Kristin McNary, Product Team Manager; Chris Shortt, Product
Manager; Maria Garguilo and Kate Mason, Learning Designers; Magesh Rajagopalan, Senior
Project Manager; Danielle Shaw, Tech Editor; and especially Michelle Ruelos Cannistraci,
Senior Content Manager, for ­handling all the details of producing this edition of the book.

About the Author


Kenneth A. Lambert is a professor of computer science and the chair of that department
at Washington and Lee University. He has taught introductory programming courses for
over 30 years and has been an active researcher in computer science education. Lambert
has authored or coauthored a total of 28 textbooks, including a series of introductory C++
­textbooks with Douglas Nance and Thomas Naps, a series of introductory Java textbooks
with Martin Osborne, and a series of introductory Python textbooks.

Dedication
To Brenda Wilson, with love and admiration.
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.
Chapter 1
Basic Python
Programming

After completing this chapter, you will be able to:

Write a simple Python program using its basic structure


Perform simple input and output operations
Perform operations with numbers such as arithmetic and
comparisons
Perform operations with Boolean values
Implement an algorithm using the basic constructs of
sequences of statements, selection statements, and loops
Define functions to structure code
Use built-in data structures such as strings, files, lists,
tuples, and dictionaries
Define classes to represent new types of objects
Structure programs in terms of cooperating functions,
data structures, classes, and modules

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 Basic Python Programming

This chapter gives a quick overview of Python programming. It is intended to bring those
new to or rusty in Python up to speed, but it does not pretend to be a thorough introduc-
tion to computer science or the Python programming language. For a more detailed treat-
ment of programming in Python, see my book Fundamentals of Python: First Programs,
Second Edition (Cengage Learning, 2019). For documentation on the Python programming
2
language, visit www.python.org.
If your computer already has Python, check the version number by running the python
or python3 command at a terminal prompt. (Linux and Mac users first open a terminal
­window, and Windows users first open a DOS window.) You are best off using the most
current version of Python available. Check for that at www.python.org, and download and
install the latest version if necessary. You will need Python 3.0 or higher to run the pro-
grams presented in this book.

Basic Program Elements


Like all contemporary programming languages, Python has a vast array of features and
constructs. However, Python is among the few languages whose basic program ele-
ments are quite simple. This section discusses the essentials to get you started in Python
programming.

Programs and Modules


A Python program consists of one or more modules. A module is just a file of Python code,
which can include statements, function definitions, and class definitions. A short Python
program, also called a script, can be contained in one module. Longer, more complex pro-
grams typically include one main module and one or more supporting modules. The main
module contains the starting point of program execution. Supporting modules contain
function and class definitions.

An Example Python Program: Guessing a Number


Next, you’ll see a complete Python program that plays a game of guess-the-number with
the user. The computer asks the user to enter the lower and upper bounds of a range of
numbers. The computer then “thinks” of a random number in that range and repeatedly
asks the user to guess this number until the user enters a correct guess. The computer gives
a hint to the user after each guess and displays the total number of guesses at the end of the
process. The program includes several of the types of Python statements to be discussed
later in this chapter, such as input statements, output statements, assignment statements,
loops, and conditional statements. The program also includes a single function definition.
Here is the code for the program, in the file numberguess.py:
"""
Author: Ken Lambert
Plays a game of guess the number with the user.
"""

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.
Basic Program Elements

import random

def main():
"""Inputs the bounds of the range of numbers
and lets the user guess the computer’s number until
the guess is correct."""
smaller = int(input("Enter the smaller number: ")) 3
larger = int(input("Enter the larger number: "))
myNumber = random.randint(smaller, larger)
count = 0
while True:
count += 1
userNumber = int(input("Enter your guess: "))
if userNumber < myNumber:
print("Too small")
elif userNumber > myNumber:
print("Too large")
else:
print("You’ve got it in", count, "tries!")
break

if __name__ == "__main__":
main()

Here is a trace of a user’s interaction with the program:


Enter the smaller number: 1
Enter the larger number: 32
Enter your guess: 16
Too small
Enter your guess: 24
Too large
Enter your guess: 20
You’ve got it in 3 tries!

Note that the code and its trace appear in the colors black, blue, orange, and green. Python’s
IDLE uses color coding to help the reader recognize various types of program elements.
The role of each color will be explained shortly.

Editing, Compiling, and Running Python Programs


You can run complete Python programs, including most of the examples presented, by
entering a command in a terminal window. For example, to run the program contained in
the file numberguess.py, enter the following command in most terminal windows:
python3 numberguess.py

To create or edit a Python module, try using Python’s IDLE (short for Integrated
­DeveLopment Environment). To start IDLE, enter the idle or idle3 command at a terminal
prompt or launch its icon if it is available. You can also launch IDLE by double-clicking on
a Python source code file (any file with a .py extension) or by right-clicking on the file and

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 Basic Python Programming

selecting Open or Edit with IDLE. Make sure that your system is set to open IDLE when
files of this type are launched (this is the default on macOS but not on Windows).
IDLE gives you a shell window for interactively running Python expressions and statements.
Using IDLE, you can move back and forth between editor windows and the shell window to
develop and run complete programs. IDLE also formats your code and color-codes it.
4
When you open an existing Python file with IDLE, the file appears in an editor window, and
the shell pops up in a separate window. To run a program, move the cursor into the editor
window and press the F5 (function-5) key. Python compiles the code in the editor window
and runs it in the shell window.
If a Python program appears to hang or not quit normally, you can exit by pressing Ctrl+C
or closing the shell window.

Program Comments
A program comment is text ignored by the Python compiler but valuable to the reader as
documentation. An end-of-line comment in Python begins with a # symbol and extends to
the end of the current line. It is color-coded in red. For example:
# This is an end-of-line comment.

A multiline comment is a string enclosed in triple single quotes or triple double quotes.
Such comments, which are colored green, are also called docstrings, to indicate that they
can document major constructs within a program. The numberguess program shown
­earlier includes two doc strings. The first one, at the top of the program file, serves as a
comment for the entire numberguess module. The second one, just below the header of the
main function, describes what this function does. As we shall see shortly, docstrings play a
critical role in giving help to a programmer within the Python shell.

Lexical Elements
The lexical elements in a language are the types of words or symbols used to construct
­sentences. As in all high-level programming languages, some of Python’s basic symbols are
keywords, such as if, while, and def, which are colored orange. Also included among lexical
items are identifiers (names), literals (numbers, strings, and other built-in data structures),
operators, and delimiters (quotation marks, commas, parentheses, square brackets, and
braces). Among the identifiers are the names of built-in functions, which are colored purple.

Spelling and Naming Conventions


Python keywords and names are case-sensitive. Thus, while is a keyword, whereas While
is a programmer-defined name. Python keywords are spelled in lowercase letters and are
color-coded in orange in an IDLE window.

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.
Basic Program Elements

All Python names, other than those of built-in functions, are color-coded in black, except
when they are introduced as function, class, or method names, in which case they appear
in blue. A name can begin with a letter or an underscore (_), followed by any number of
­letters, underscores, or digits.
In this book, the names of modules, variables, functions, and methods are spelled in lower-
case letters. With the exception of modules, when one of these names contains one or more 5
embedded words, the embedded words are capitalized. The names of classes follow the
same conventions but begin with a capital letter. When a variable names a constant, all the
letters are uppercase, and an underscore separates any embedded words. Table 1-1 shows
examples of these naming conventions.

Type of Name Examples


Variable salary, hoursWorked, isAbsent

Constant ABSOLUTE_ZERO, INTEREST_RATE

Function or method printResults, cubeRoot, input

Class BankAccount, SortedSet

Table 1-1 Examples of Python Naming Conventions

Use names that describe their role in a program. In general, variable names should
be nouns or adjectives (if they denote Boolean values), whereas function and method
names should be verbs if they denote actions, or nouns or adjectives if they denote values
returned.

Syntactic Elements
The syntactic elements in a language are the types of sentences (expressions, statements,
definitions, and other constructs) composed from the lexical elements. Unlike most high-
level languages, Python uses white space (spaces, tabs, or line breaks) to mark the syntax
of many types of sentences. This means that indentation and line breaks are significant in
Python code. A smart editor like Python’s IDLE can help indent code correctly. The pro-
grammer need not worry about separating sentences with semicolons and marking blocks
of sentences with braces. In this book, I use an indentation width of four spaces in all
Python code.

Literals
Numbers (integers or floating-point numbers) are written as they are in other program-
ming languages. The Boolean values True and False are keywords. Some data structures,
such as strings, tuples, lists, and dictionaries, also have literals, as you will see shortly.

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 Basic Python Programming

String Literals
You can enclose strings in single quotes, double quotes, or sets of three double quotes or
three single quotes. The last notation is useful for a string containing multiple lines of text.
Character values are single-character strings. The \ character is used to escape nongraphic
characters such as the newline (\n) and the tab (\t), or the \ character itself. The next code
6 segment, followed by the output, illustrates the possibilities.
print("Using double quotes")
print('Using single quotes')
print("Mentioning the word ‘Python’ by quoting it")
print("Embedding a\nline break with \\n")
print("""Embedding a
line break with triple quotes""")

Output:
Using double quotes
Using single quotes
Mentioning the word 'Python' by quoting it
Embedding a
line break with \n
Embedding a
line break with triple quotes

Operators and Expressions


Arithmetic expressions use the standard operators (+, –, *, /, %) and infix notation. The
/ operator produces a floating-point result with any numeric operands, whereas the //
­operator produces an integer quotient. The + operator means concatenation when used
with collections, such as strings and lists. The ** operator is used for exponentiation.
The comparison operators <, <=, >, >=, ==, and != work with numbers and strings.
The == operator compares the internal contents of data structures, such as two lists, for
structural equivalence, whereas the is operator compares two values for object identity.
Comparisons return True or False.
The logical operators and, or, and not treat several values, such as 0, None, the empty string,
and the empty list, as False. In contrast, most other Python values count as True.
The subscript operator, [], used with collection objects, will be examined shortly.
The selector operator, ‘ ’, is used to refer to a named item in a module, class, or object.

The operators have the standard precedence (selector, function call, subscript, arithmetic,
comparison, logical, assignment). Parentheses are used in the usual manner, to group sub-
expressions for earlier evaluation.
The ** and = operators are right associative, whereas the others are left associative.

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.
Basic Program Elements

Function Calls
Functions are called in the usual manner, with the function’s name followed by a parenthe-
sized list of arguments. For example:
min(5, 2) # Returns 2

Python includes a few standard functions, such as abs and round. Many other functions are 7
available by import from modules, as you will see shortly.

The print Function


The standard output function print displays its arguments on the console. This function
allows a variable number of arguments. Python automatically runs the str function on each
argument to obtain its string representation and separates each string with a space before
output. By default, print terminates its output with a newline.

The input Function


The standard input function input waits for the user to enter text at the keyboard. When the
user presses the Enter key, the function returns a string containing the characters entered.
This function takes an optional string as an argument and prints this string, ­without a line
break, to prompt the user for the input.

Type Conversion Functions and Mixed-Mode Operations


You can use some data type names as type conversion functions. For example, when the
user enters a number at the keyboard, the input function returns a string of digits, not a
numeric value. The program must convert this string to an int or a float before numeric
processing. The next code segment inputs the radius of a circle, converts this string to a
float, and computes and outputs the circle’s area:

radius = float(input("Radius: "))


print("The area is", 3.14 * radius ** 2)

Like most other languages, Python allows operands of different numeric types in arithmetic
expressions. In those cases, the result type is the same type as the most general operand
type. For example, the addition of an int and a float produces a float as the result.

Optional and Keyword Function Arguments


Functions may allow optional arguments, which can be named with keywords when the
function is called. For example, the print function by default outputs a newline after

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 Basic Python Programming

its arguments are displayed. To prevent this from happening, you can give the optional
­argument end a value of the empty string, as follows:
print("The cursor will stay on this line, at the end", end = "")

Required arguments have no default values. Optional arguments have default values and
can appear in any order when their keywords are used, as long as they come after the
8
required arguments.
For example, the standard function round expects one required argument, a rounded num-
ber, and a second, optional argument, the number of figures of precision. When the second
argument is omitted, the function returns the nearest whole number (an int). When the
second argument is included, the function returns a float. Here are some examples:
>>> round(3.15)
3

>>> round(3.15, 1)
3.2

In general, the number of arguments passed to a function when it is called must be at least
the same number as its required arguments.
Standard functions and Python’s library functions check the types of their arguments when
the function is called. Programmer-defined functions can receive arguments of any type,
including functions and types themselves.

Variables and Assignment Statements


A Python variable is introduced with an assignment statement. For example:
PI = 3.1416

sets PI to the value 3.1416. The syntax of a simple assignment statement is:
<identifier> = <expression>

Several variables can be introduced in the same assignment statement, as follows:


minValue, maxValue = 1, 100

To swap the values of the variables a and b, you write:


a, b = b, a

Assignment statements must appear on a single line of code, unless the line is broken after
a comma, parenthesis, curly brace, or square bracket. When these options are unavailable,
another means of breaking a line within a statement is to end it with the escape symbol \.
You typically place this symbol before or after an operator in an expression. Here are some
admittedly unrealistic examples:
minValue = min(100,
200)
product = max(100, 200) \
* 30
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.
Basic Program Elements

When you press Enter after a comma or the escape symbol, IDLE automatically indents the
next line of code.

Python Data Typing


9
In Python, any variable can name a value of any type. Variables are not declared to have a
type, as they are in many other languages; they are simply assigned a value.
Consequently, data type names almost never appear in Python programs. However, all
­values or objects have types. The types of operands in expressions are checked at run time,
so type errors do not go undetected; however, the programmer does not have to worry
about mentioning data types when writing code.

import Statements
The import statement makes visible to a program the identifiers from another module.
These identifiers might name objects, functions, or classes. There are several ways to
express an import statement. The simplest is to import the module name, as in:
import math

This makes any name defined in the math module available to the current module, by using
the syntax math.<name>. Thus, math.sqrt(2) would return the square root of 2.
A second style of importing brings in a name itself, which you can use directly without the
module name as a prefix:
from math import sqrt
print(sqrt(2))

You can import several individual names by listing them:


from math import pi, sqrt
print(sqrt(2) * pi)

You can import all names from a module using the * operator, but that is not usually
­considered good programming practice.

Getting Help on Program Components


Although the Python website at www.python.org has complete documentation for the
Python language, help on most language components is also readily available within
the Python shell. To access such help, just enter the function call help(<component>) at the
shell prompt, where <component> is the name of a module, data type, function, or method.
For example, help(abs) and help(math.sqrt) display documentation for the abs and
math.sqrt functions, respectively. Calls of dir(int) and dir(math) list all the operations
in the int type and math module, respectively. You can then run help to get help on one of
these operations.
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 Basic Python Programming

Note that if a module is not the built-in module that Python loads when the shell starts, the
programmer must first import that module before asking for help on it. For example, the
following session with the shell displays the documentation for the numberguess program
discussed earlier in this chapter:
>>> import numberguess
10 >>> help(numberguess)
Help on module numberguess:
NAME
numberguess
DESCRIPTION
Author: Ken Lambert
Plays a game of guess the number with the user.
FUNCTIONS
main()
Inputs the bounds of the range of numbers,
and lets the user guess the computer’s number until
the guess is correct.
FILE
/Users/ken/Documents/CS2Python/Chapters/Chapter1/numberguess.py

Control Statements
Python includes the usual array of control statements for sequencing, conditional execu-
tion, and iteration. A sequence of statements is a set of statements written one after the
other. Each statement in a sequence must begin in the same column. This section examines
the control statements for conditional execution and iteration.

Conditional Statements
The structure of Python’s conditional statements is similar to that of other languages. The
keywords if, elif, and else are significant, as is the colon character and indentation.
The syntax of the one-way if statement is:
if <Boolean expression>:
<sequence of statements>

A Boolean expression is any Python value; as mentioned earlier, some of these count as
False, and the others count as True. If the Boolean expression is True, the sequence of
statements is run; otherwise, nothing happens. The sequence of (one or more) statements
must be indented and aligned at least one space or tab (typically four spaces). The colon
character is the only separator; if there is only one statement in the sequence, it may imme-
diately follow the colon on the same line.
The syntax of the two-way if statement is:
if <Boolean expression>:
<sequence of statements>
else:
<sequence of statements>
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.
Control Statements

Note the indentation and the colon following the keyword else. Exactly one of these two
sequences of statements will be run. The first sequence is run if the Boolean expression is
True; the second sequence is run if the Boolean expression is False.

The syntax of the multiway if statement is:


if <Boolean expression>:
<sequence of statements>
11
elif <Boolean expression>:
<sequence of statements>
...
else:
<sequence of statements>

A multiway if statement runs exactly one sequence of statements. The multiway if


s­ tatement includes one or more alternative Boolean expressions, each of which follows the
keyword elif. You can omit the trailing else: clause.
The next example outputs the appropriate answer to a question about the relative sizes of
two numbers:
if x > y:
print("x is greater than y")
elif x < y:
print("x is less than y")
else:
print("x is equal to y")

Using if __name__ == "__main__"


The numberguess program discussed earlier includes the definition of a main function and
the following if statement:
if __name__ == "__main__":
main()

The purpose of this if statement is to allow the programmer either to run the module as a
standalone program or to import it from the shell or another module. Here is how this works:
every Python module includes a set of built-in module variables, to which the Python vir-
tual machine automatically assigns values when the module is loaded. If the module is being
loaded as a standalone program (either by running it from a terminal prompt or by loading it
from an IDLE window), the module’s __name__ variable is set to the string "__main__".
Otherwise, this variable is set to the module’s name—in this case, "numberguess". Either
assignment is accomplished before any of the code within the module is loaded. Thus, when
control reaches the if statement at the end of the module, the module’s main function will be
called only if the module has been launched as a standalone program.
The if __name__ == "__main__" idiom is useful when developing standalone program
modules, because it allows the programmer to view help on the module just by importing it
into the shell. Likewise, the programmer can use this idiom in supporting modules to run a
test bed function during module development within IDLE.
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.
Another Random Scribd Document
with Unrelated Content
tappioista. Niitä orjia, jotka siirretään outoon ilmanalaan, kuolee
siellä tuhansittain. Ja kaivostyöt, joihin käytetään lakkaamatta sekä
maan alkuasukkaita että muukalaisia, ne epäterveelliset huurut,
jotka näistä kaivoksista nousevat, elohopea, johon täytyy alituisesti
turvautua, tuhoavat heitä armottomasti.

Ei ole mitään niin mieletöntä kuin hävittää lukemattomia


ihmishenkiä penkoakseen maan uumenista kultaa ja hopeaa, näitä
itsessään täysin hyödyttömiä metalleja, jotka esiintyvät rikkauksina
vain siksi, että ne on valittu rikkauksien merkeiksi.

Pariisissa, Chahban-kuun viimeisenä päivänä v. 1718.

120. kirje.

Usbek kirjoittaa samalle.

Jonkin kansan hedelmällisyys riippuu joskus maailman


vähäpätöisimmistä seikoista. Useinkaan ei tarvita muuta kuin pieni
käänne sen mielikuvitukseen, kun sen luku jo suuresti lisääntyy
entisestään.

Juutalaiset, joita aina tuhotaan ja jotka aina syntyvät uudelleen,


ovat korjanneet lakkaamattomat menetyksensä ja häviönsä
yksinomaan sen toivon turvin, mikä heidän keskuudessaan elähyttää
jokaista perhettä, että nimittäin sen helmasta syntyy kerran mahtava
kuningas, josta on tuleva maailman herra.

Persian muinaisilla kuninkailla oli niin monen monia tuhansia


alamaisia vain sen tietäjäpappien uskontoon kuuluvan opinkappaleen
takia, että Jumalalle mieluisimmat teot, mitä ihminen saattaa tehdä,
olivat lapsen siittäminen, pellon muokkaaminen ja puun
istuttaminen.

Kun Kiinalla on helmassaan suunnaton asukasjoukko, johtuu se


vain eräästä määrätystä ajatustavasta. Sillä kun lapset pitävät
isäänsä jumalana, kun he kunnioittavat häntä sellaisena jo tässä
elämässä, kun he palvovat häntä hänen kuoltuaan uhreilla, joiden
avulla he luulevat hänen Tyeniin haihtuneen sielunsa saavan uuden
elämän, on jokainen halukas lisäämään perhettä, joka on niin
kuuliainen tässä elämässä ja niin tarpeellinen toisessa.

Toiselta puolen autioituvat muhamettilaiset maat päivä päivältä


erään katsantokannan johdosta, joka, niin pyhä kuin se onkin,
vaikuttaa hyvin turmiollisesti silloin kun se on juurtunut mieliin. Me
pidämme itseämme matkustajina, joiden tulee ajatella vain toista
isänmaata. Hyödylliset ja kestävät työt, huolehtiminen lastemme
tulevaisuuden varmentamisesta, lyhyen, ohimenevän elämän tuolle
puolen ulottuvat suunnitelmat tuntuvat meistä järjettömiltä.
Rauhallisina nykyisyydestä, huolettomina tulevaisuudesta me emme
katso maksavan vaivaa korjata julkisia rakennuksia, perata pelloksi
uusia maita tai viljellä niitä, jotka kaipaavat hoitoamme. Me elämme
yleisessä unteluudessa ja heitämme kaikki Kaitselmuksen haltuun.

Turhamaisuuden henki on saanut eurooppalaiset perustamaan


kohtuuttoman esikoisoikeuden, joka on hyvin haitallinen suvun
lisääntymiselle, koska se ohjaa isän huomion vain yhteen lapseen ja
kääntää hänen silmänsä toisista, koska se pakottaa hänet
vastustamaan useampien varallisuuden perustamista, tehdäkseen
yhden ainoan varallisuuden varmaksi ja koska se vihdoin hävittää
kansalaisten tasa-arvoisuuden, joka muodostaa koko heidän
äveriäisyytensä.

Pariisissa, 4 p. Rhamazan-kuuta v. 1718.

121. kirje.

Usbek kirjoittaa samalle.

Villien asumissa maissa on tavallisesti hyvin vähän väkeä, koska he


melkein kaikki vierovat työtä ja maan viljelemistä. Tämä onneton
vastenmielisyys on niin voimakas, että kun he milloin kiroavat
vihollistaan, toivottelevat he hänen joutuvan muokkaamaan maata,
koska he uskovat vain metsästyksen ja kalastuksen olevan jaloa ja
heille soveltuvaa askaretta.

Mutta kun metsästys ja kalastus tuottavat useina vuosina varsin


vähän, ahdistaa nälkä heitä tuon tuostakin, ottamattakaan lukuun
sitä seikkaa, ettei ole niin riista- ja kalarikasta seutua, joka voisi
elättää suurta kansanpaljoutta, koska eläimet pakenevat aina liian
asuttuja tienoita.

Muutoin eivät villien kyläyhteiskunnat, joissa on pari, kolme sataa


asukasta, jotka ovat toisistaan eristettyjä ja joilla on yhtä
vastakkaiset edut kuin kahdella valtakunnalla ikään, saata pysyä
pystyssä, koska niillä ei ole suurten valtioiden apukeinoja, valtioiden,
joiden kaikki osat tukevat ja avustavat toisiaan.

Villeillä on muuan toinenkin tottumus, joka on yhtä turmiollinen


kuin tämä ensimmäinenkin, nimittäin naisten julma
sikiönlähdettämistapa, jottei heidän raskautensa tekisi heitä heidän
miestensä silmissä epämiellyttäviksi.

Täällä taas ovat voimassa hirvittävän ankarat lait tätä


vallattomuutta vastaan, menevätpä ne siinä suhteessa aivan
liiallisuuksiin. Jokaista neitoa, joka ei ole käynyt ilmoittamassa
raskauttaan viranomaisille, rangaistaan kuolemalla, jos hänen
kohtunsa hedelmä kuolee: ei kainous eikä häpeä eivätkä
tapaturmatkaan riitä hänelle milloinkaan puolustukseksi.

Pariisissa, 9 p. Rhamazan-kuuta v. 1718.

122. kirje.

Usbek kirjoittaa samalle.

Siirtokuntien tavallinen vaikutus on se, että ne heikontavat maita,


jotka niitä perustavat, kansoittamatta maita, joihin niitä perustetaan.

Ihmisten tulee pysyä siellä, missä he ovat. On tauteja, jotka


johtuvat siitä, että vaihdetaan hyvä ilma huonoon. Toiset taas
johtuvat siitä, että ylimalkaan ilmanalaa vaihdetaan.

Ilmaan imeytyy, niinkuin kasveihinkin, kunkin seudun


maahiukkasia, ja se vaikuttaa meihin niin voimakkaasti, että se
määrää luonnonlaatumme. Kun me siirrymme toiseen maahan,
tulemme sairaiksi. Koska nesteet ovat tottuneet johonkin määrättyyn
tiheyteen ja molemmat johonkin määrättyyn liikenopeuteen, eivät ne
saata enää muita sietää, vaan vastustavat uusia järjestelyjä.
Milloin joku maa pysyy autiona, on se merkkinä jostakin ilmaston
laadussa vallitsevasta erikoisesta viasta. Jos siis riistetään ihmiset
onnellisen taivaan alta ja lähetetään heidät sellaiseen maahan,
tehdään täsmälleen päinvastoin kuin tarkoitetaan.

Roomalaiset tiesivät sen kokemuksesta. He karkottivat kaikki


rikollisensa Sardiniaan ja asuttivat siellä myös juutalaisia. Näiden
ihmisten tuhoutuminen oli kestettävä, mutta sen teki heille hyvin
helpoksi se halveksunta, jota he tunsivat näitä kurjia kohtaan.

Suuri shaahi Abbas, joka tahtoi riistää turkkilaisilta mahdollisuuden


pitää suuria sotajoukkoja rajoilla, siirsi melkein kaikki armenialaiset
maastaan ja lähetti heitä yli kaksikymmentätuhatta perhettä Guilanin
maakuntaan, missä he hyvin pian kuolivat melkein kaikki.

Mitkään kansojensiirrot Konstantinopoliin eivät ole milloinkaan


onnistuneet.

Se suunnaton määrä neekereitä, josta puhuimme, ei ole suinkaan


täyttänyt Amerikkaa.

Sen jälkeen kun Hadrianus hävitti juutalaiset, on Palestiina ollut


vailla asujamia.

Täytyy siis myöntää, että suuret hävitykset ovat miltei


korjaamattomia, koska kansa, joka on jossakin suhteessa rappiolla,
pysyy edelleenkin samassa tilassa. Ja jos se sattumalta kohentuukin,
menee siihen vuosisatoja.

Mutta jos tuollaisessa voipumuksen tilassa pieninkin äsken


koskettelemamme seikka sattuu vaikuttamaan, ei kansa kohennu,
vaan raukeaa päivä päivältä ja käy tuhoaan kohti.
Maurien karkottaminen Espanjasta tuntuu vieläkin yhtä hyvin kuin
ensimmäisenä päivänä, siten syntynyt tyhjyys kun ei suinkaan täyty,
vaan laajenee päivä päivältä.

Hävitettyään Amerikan eivät espanjalaiset, jotka ovat anastaneet


entisten asukkaiden sijan, ole voineet kansoittaa sitä uudelleen, vaan
hävittäjät hävittävät itsensä ja kuihtuvat lakkaamatta tuhoisan
kohtalon, tai niinkuin minä mieluummin sanoisin, jumalallisen
oikeuden iskeminä.

Ruhtinaiden ei siis pidä ajatella laajojen maiden kansoittamista


siirtokuntien avulla. En kuitenkaan väitä, etteivät ne saattaisi joskus
onnistuakin. Onhan niin onnellisia ilmanaloja, että ihmissuku
lisääntyy siellä aina. Siitä ovat todistuksena eräät saaret, joiden
kansoittamisen ovat toimittaneet laivoista niiden rannikolle heitetyt ja
siellä hyvin pian parantuneet sairaat.

Mutta milloin nämä siirtokunnat menestyvät, eivät ne suinkaan


lisää emämaan mahtia, vaan jakavat sen, elleivät ne ole alueeltaan
hyvin pieniä, niinkuin sellaiset, jotka lähetetään valtaamaan joitakin
tukikohtia kaupalle.

Kartagolaiset olivat, niinkuin myöhemmin espanjalaiset, löytäneet


Amerikan tai ainakin muutamia suuria saaria, joilla he harjoittivat
suunnatonta kauppaa. Mutta kun he huomasivat asukasmääränsä
vähenevän, kielsi tämä viisas tasavalta alamaisiaan harjoittamasta
sitä kauppaa ja meriliikettä.

Uskallan sanoa, ettei suinkaan tule kuljettaa espanjalaisia Länsi-


Intiaan, vaan päinvastoin pitäisi siirtää intiaanit ja kaikki sekarotuiset
Espanjaan. Pitäisi palauttaa tälle valtakunnalle kaikki sen sinne tänne
sirotellut kansat, ja jos tosiaan vain puoletkin näistä suurista
siirtomaista säilyisi, tulisi Espanjasta Euroopan pelättävin suurvalta.

Valtakuntia voidaan verrata puuhun, jonka liian laajalle leviävät


oksat imevät kaiken mehun rungosta ja synnyttävät vain varjoa.

Ei mikään pitäisi niin perinpohjin parantaman ruhtinaita kaukaisten


valloitusten kiihkosta kuin portugalilaisten ja espanjalaisten
esimerkin.

Valloitettuaan uskomattoman nopeasti äärettömiä alueita ja


hämmästeltyään itsekin näitä voittojaan enemmän kuin kukistetut
kansat tappioitaan, miettivät nämä molemmat kansat niiden
säilyttämisen keinoja ja kulkivat siinä kumpainenkin eri tietä.

Kun espanjalaiset eivät katsoneet jaksavansa pakottaa voitettuja


kansakuntia uskollisuuteen, pitivät he parempana surmata ne
sukupuuttoon ja lähettää niiden tilalle Espanjasta luotettavaa väkeä,
eikä milloinkaan ole kauheampaa suunnitelmaa täsmällisemmin
toteutettu. Nähtiinhän silloin kansan, yhtä lukuisan kuin kaikki
Euroopan kansat yhteensä, katoavan maan päältä näiden
raakalaisten saapuessa, raakalaisten, jotka näyttivät Länsi-Intian
keksiessään halunneen samalla osoittaa ihmisille keksineensä
julmuuden korkeimman asteen.

Tällaisen raakalaisuuden avulla saivat he säilymään sanotun maan


vallassaan. Huomaa siitä, kuinka tuhoisia valloitukset ovat, koska
niiden seurauksetkin ovat tuollaisia, sillä tämä inhoittava apukeino oli
tosiaankin ainoa. Kuinka he olisivatkaan kyenneet pitämään niin
monia miljoonia ihmisiä kurissa? Kuinka he olisivatkaan jaksaneet
käydä sisäistä sotaa niin pitkän matkan takaa? Mitä heistä olisikaan
tullut, jos he olisivat antaneet näille kansoille aikaa toipua
ihmetyksestä, johon ne olivat vaipuneet näiden uusien jumalain
saapuessa ja heidän pelottavien salamainsa leimahtaessa?

Portugalilaiset kulkivat taas kokonaan vastakkaista tietä. He eivät


käyttäneet julmuutta. Mutta niinpä karkotettiinkin heidät pian
kaikista maista, jotka he olivat löytäneet. Hollantilaiset tukivat näiden
kansojen kapinaa ja käyttivät sitä hyödykseen.

Kuka ruhtinas kadehtisi näiden valloittajien kohtaloa? Kuka haluaisi


tehdä sellaisia valloituksia sellaisilla ehdoilla? Toiset karkotettiin
anastetuilta alueilta tuota pikaa. Toiset tekivät niistä erämaita ja
toimittivat saman osan omallekin maalleen.

Sankarien arpana onkin perikatoon syöksyminen sellaisia maita


valloittaessaan, jotka he pian taas menettävät, tai sellaisia kansoja
kukistaessaan, jotka heidän on pakko itse tuhota. He muistuttavat
mielipuolta, joka tuhlasi omaisuutensa ostamalla kuvapatsaita, mitkä
hän heitti mereen, ja peilejä, mitkä hän heti rikkoi.

Pariisissa, 18 p. Rhamazan-kuuta v. 1718.

123. kirje.

Usbek kirjoittaa samalle.

Hallituksen lempeys edistää ihmeellisesti suvun lisääntymistä.


Kaikki tasavallat ovat siitä pysyvänä todistuksena, ja muita enemmän
Sveitsi ja Hollanti, jotka ovat Euroopan kehnoimmat valtiot
maanlaadun puolesta, mutta jotka ovat kuitenkin tiheimmin asuttuja.
Ei mikään vedä niin muukalaisia puoleensa kuin vapaus ja aina sitä
seuraava varallisuus: edellistä haetaan sen itsensä takia, ja tarve tuo
ihmisiä maahan, mistä on saatavissa jälkimmäistä.

Suku lisääntyy maassa, missä yltäkylläisyys tyydyttää lasten


tarpeet, silti lainkaan vähentämättä vanhempain hyvinvointia.

Myöskin kansalaisten tasa-arvoisuus, joka synnyttää tavallisesti


varallisuuden tasa-arvoisuuden, kuljettaa ja levittää yltäkylläisyyttä ja
elämää valtioruumiin kaikkiin osiin.

Niin ei ole laita mielivallan alamaisuuteen taivutettujen maiden.


Ruhtinas, hovikot ja muutamat yksityiset pitävät hallussaan kaikkia
rikkauksia, kaikkien muiden huokaillessa äärimmäisessä
köyhyydessä.

Jos mies elää huonoissa varoissa ja jos hän oivaltaa siittävänsä


vielä itseäänkin köyhempiä lapsia, ei hän mene naimisiin. Ja jos hän
naimisiin meneekin, pelkää hän liian suurta lapsilaumaa, koska nämä
lapset voisivat saattaa hänen taloudelliset olonsa lopulliseen
epäjärjestykseen ja koska he varmaankin joutuisivat isänsä
varallisuustasoa alemmaksi.

On myönnettävä, että maalainen eli talonpoika, kun hän on kerran


mennyt naimisiin, kansoittaa maata mistään huolimatta. Oli hän
sitten rikas tai köyhä, ei se asia liikuta häntä: hänellähän on aina
varma perintö jätettävänä lapsilleen, nimittäin kuokka. Eikä näin
mikään estä häntä sokeasti seuraamasta luonnon viettiä.

Mutta mitä hyödyttää valtiota tämä kurjuudessa kituvain lasten


joukko? Nehän kuolevat melkein kaikki sitä mukaa kuin syntyvät.
Eikä niistä tule milloinkaan oikein vankkaa väkeä: heikkoina ja
raihnaisina he heittävät yksitellen henkensä tuhansista syistä,
samalla kun niitä surmaavat summissa ne lukuisat kulkutaudit, joita
kurjuus ja huono ravinto aina aiheuttavat. Ne, jotka niiltä säästyvät,
pääsevät miehen ikään pääsemättä sen voimaan ja kituvat koko
lopun elämänsä.

Ihmiset ovat kuin kasveja, jotka eivät milloinkaan menesty, ellei


niitä hyvin hoideta. Kurjuudessa eläväin kansojen keskuudessa
vähenee suku, jopa joskus huononeekin lajistaan.

Ranska on kaikesta tästä oivallisena esimerkkinä. Äskeisten sotien


aikana oli kaikkien alaikäistenkin pakko mennä naimisiin, koska he
pelkäsivät joutuvansa sotaväkeen. Avioliitot solmittiin siis liian
aikaisin ja lisäksi suuressa köyhyydessä. Niin monista avioliitoista
syntyi tietysti paljon lapsia, mutta niitä saa turhaan etsiä nykypäivien
Ranskasta, koska kurjuus, nälkä ja taudit ovat ne korjanneet sen
pinnalta.

Jos niin suotuisassa ilmanalassa, niin hyvin järjestetyssä


kuningaskunnassa kuin Ranskassa tehdään moisia huomioita, niin
miten ovatkaan asiat muissa valtioissa?

Pariisissa, 23 p. Rhamazan-kuuta v. 1718.

124. kirje.

Usbek kirjoittaa pappi Mehemet Alille, Kolmen Haudan vartijalle


Kumiin.
Mitä meitä auttavat immaumien paastot ja pappien jouhipaidat?
Jumalan käsi on kaksi kertaa raskaasti painanut lain lapsia. Aurinko
himmentyy ja näyttää valaisevan vain heidän tappioitaan: heidän
sotajoukkonsa kokoontuvat, mutta ne hajoitetaan kuin tuhka.

Osmannien valtaa järisyttää kaksi ankarinta iskua, mitä se on


milloinkaan saanut. Muuan kristitty mufti pitää sitä vain vaivoin
pystyssä. Saksan suurvisiiri on Jumalan vitsa, joka on lähetetty
kurittamaan Omarin kannattajia. Hän levittää kaikkialle heidän
kapinoimisestaan ja petollisuudestaan raivostuneen taivaan vihaa.

Immaumien pyhä henki, Sinä itket yötä ja päivää Profeetan lapsia,


jotka inhoittava Omar on vienyt väärille poluille. Sinun sisimmän
sydämesi valtaa liikutus, kun Sinä katselet heidän onnettomuuksiaan.
Sinä haluat heidän kääntymistään etkä heidän turmiotaan. Sinä
tahtoisit koota heidät Alin lipun ympärille pyhimysten kyyneleiden
voimalla etkä nähdä uskottomien kauhun hajoittavan heitä vuorille ja
erämaihin.

Pariisissa, 1 p. Chalval-kuuta v. 1718.

125. kirje.

Usbek kirjoittaa Rhedille Venetsiaan.

Mikä saattaa aiheuttaa sen suunnattoman anteliaisuuden, jota


ruhtinaat osoittavat hovikoilleen? Tahtovatko he kiinnittää nämä
itseensä? Mutta hehän ovat jo niin kokonaan heidän omiaan kuin he
suinkin voivat olla. Ja jos he sitäpaitsi hankkivat muutamia
alamaisiaan omikseen ostamalla heidät, täytyy heidän juuri siitä
syystä menettää äärettömän paljon toisia alamaisia köyhdyttämällä
heidät.

Ajatellessani ruhtinaiden asemaa, heitä kun aina ympäröivät


ahnaat, kyllääntymättömät henkilöt, en voi muuta kuin surkutella
heitä. Ja minä surkuttelen heitä vielä enemmän silloin kun heillä ei
ole voimaa vastustaa pyyntöjä, mitkä koituvat aina niiden
rasitukseksi, jotka eivät pyydä mitään.

En voi milloinkaan kuulla puhuttavan heidän anteliaisuudestaan,


armonosoituksistaan, eläkkeistään vaipumatta tuhansiin mietteisiin.
Kokonainen lauma ajatuksia tulvahtaa mieleeni. On kuin kuulisin
julistettavan seuraavaa käskykirjettä:

"Sitten kun erinäisten alamaistemme väsymätön apurahojen


pyytämisen into on lakkaamatta vedonnut Meidän kuninkaalliseen
anteliaisuuteemme, olemme vihdoin suvainneet myöntyä niihin
monilukuisiin anomuksiin, joita he ovat Meille esittäneet ja jotka ovat
tähän asti olleet valtaistuimen suurimpana murheena. He ovat
tehneet Meille tiettäväksi, etteivät he ole sen jälkeen kun kruunu on
Meille joutunut olleet kertaakaan poissa Meidän
aamuvastaanotostamme, että Me olemme aina nähneet heidät
tiemme varrella liikkumattomina kuin rajapylväät ja että he ovat
kurottautuneet niin paljon kuin ovat ikänänsä voineet katsellakseen
korkeimpienkin olkapäiden yli Meidän Jalouttamme. Edelleen olemme
saaneet useita anomuksia eräiltä kauniimpaan sukupuoleen
kuuluvilta henkilöiltä, jotka ovat rukoilleet Meitä ottamaan
huomioomme, että heidän toimeentulonsa kysyy tiettävästi suuria
kustannuksia. Niinikään ovat erinäiset sangen iäkkäät naiset päätään
heilutellen pyytäneet Meitä laskemaan sydämellemme, että he ovat
olleet hovin koristuksina Meidän kuninkaallisten edeltäjiemme aikana
ja että jos heidän sotajoukkojensa päälliköt ovat tehneet valtion
pelätyksi sotaisilla urotöillään, ovat he puolestaan tehneet hovin yhtä
kuuluisaksi juonillaan. Koska Me haluamme kohdella anojia
ystävällisesti ja myöntyä kaikkiin heidän pyyntöihinsä, olemme me
säätäneet ja käskeneet seuraavaa:

"Että jokaisen maanmiehen, jolla on viisi lasta, tulee joka päivä


vähentää viidennellä osalla leipämäärää, minkä hän heille antaa. Me
velvoitamme perheenisiä toimittamaan tämän vähennyksen kunkin
osasta niin tasapuolisesti kuin suinkin mahdollista.

"Me kiellämme nimenomaisesti kaikkia niitä, jotka harjoittavat


perintötilojensa viljelemistä tai jotka ovat antaneet ne vuokralle,
toimittamasta niillä parannuksia, millaisia ne sitten lienevätkään.

"Me määräämme, etteivät ne henkilöt, jotka harjoittavat alhaisia


ammatteja tai käsitöitä ja jotka eivät ole milloinkaan olleet Meidän
Majesteettimme aamuvastaanotossa, saa vastedes ostaa vaatteita
itselleen, vaimolleen tai lapsilleen useammin kuin joka neljäs vuosi.
Lisäksi kiellämme Me heiltä ankarasti kaikki ne pienet huvittelut, joita
heidän on ollut tapa panna toimeen perheissään vuoden suurimpina
juhlina.

"Koska Meidän tietoomme on edelleen tullut, että useimmat


Meidän kunnon kaupunkiemme porvarit ovat kokonaan vajonneet
huolehtimaan tytärtensä naittamisesta, mitkä tyttäret ovat Meidän
valtakunnassamme herättäneet suosiollista huomiota vain
murheellisella ja ikävällä kainoudella, käskemme Me heitä
viivyttämään heidän avioliittoansa siksi kunnes heidät, sitten kun he
ovat saavuttaneet asetusten määräämän iän, nämä asetukset siihen
pakottavat. Lisäksi kiellämme virkamiehiämme pitämästä tointa
lastensa kasvatuksesta."

Pariisissa, 1 p. Chalval-kuuta v. 1718.

126. kirje.

Rica kirjoittaa ———:lle.

Kaikki uskonnot joutuvat pahaan pulaan silloin kun olisi annettava


jonkinlainen käsitys niitä ihmisiä odottavista nautinnoista, jotka ovat
hyvin eläneet. Pahoja ihmisiä pelotellaan helposti monen monilla
rangaistuksilla, joilla heitä uhataan. Mutta hyveellisille ihmisille ei
tiedetä mitä luvata. Näyttää kuin kuuluisi nautintojen luontoon
lyhytaikaisuus: mielikuvituksen on vaikea keksiä muunlaisia
nautintoja.

Minä olen lukenut sellaisia paratiisin kuvauksia, jotka ovat totisesti


omiaan karkottamaan jokaisen järkevän ihmisen mielestä halun
päästä sinne. Toiset panevat nämä onnelliset varjot lakkaamatta
soittamaan huilua. Toiset tuomitsevat heidät iankaikkisen
käyskentelyn vaivaan. Kolmannet vihdoin, jotka saattavat heidät
siellä ylhäällä haaveilemaan tämän alhaisen maailman rakastettuja,
eivät ole luulleet sataa miljoonaa vuotta niin pitkäksi ajaksi, että
heiltä olisi sen kuluessa mennyt moisten lemmensurujen halu.

Tässä yhteydessä muistan tarinan, jonka minulle kertoi muuan


Mogulin maassa käynyt mies. Se osoittaa, että intialaiset papit ovat
yhtä hedelmättömiä kuin muut kun on kysymys paratiisin riemujen
kuvitteluista.

Muuan vaimo, joka oli menettänyt miehensä, saapui juhlallisesti


kaupungin kuvernöörin luo kysymään, saisiko hän polttaa itsensä.
Mutta kun muhamettilaisten valtaan joutuneissa maissa koetetaan
parhaan mukaan poistaa tätä julmaa tapaa, epäsi kuvernööri jyrkästi
vaimon pyynnön.

Kun tämä huomasi rukouksensa tehottomiksi joutui hän


kauhistuttavaan kiihkoon. "Katsokaa", huusi hän, "katsokaa, millaista
pakkovaltaa täällä harjoitetaan! Vaimoraukka ei saa edes polttaa
itseään silloin kun hänen mielensä tekee! Onko milloinkaan nähty
moista? Äitini, tätini, sisareni, kaikki ovat kunnollisesti palaneet.
Mutta kun minä tulen pyytämään lupaa tältä kirotulta kuvernööriltä,
suuttuu hän ja alkaa kirkua kuin raivohullu."

Sattumalta oli siinä läsnä muuan nuori Buddhan pappi. "Uskoton


ihminen", huusi hänelle kuvernööri, "sinäkö olet ajanut tuollaisen
kiihkon tämän vaimon päähän?"

"En", vastasi tämä, "en ole milloinkaan häntä edes puhutellut.


Mutta jos hän tahtoo minua uskoa, suorittaa hän kyllä uhrinsa, koska
hän siten tekee Brahma-jumalaa miellyttävän teon. Niinpä saakin
hän siitä hyvän palkinnon, sillä hän on toisessa maailmassa tapaava
miehensä ja alottava hänen kanssaan uuden avioliiton."

"Mitä te sanotte?" hämmästyi vaimo. "Tapaanko minä mieheni?


Ah! silloin minä en poltakaan itseäni. Hän oli mustasukkainen,
kärtyisä ja siksi toiseksi niin vanhakin, että ellei Brahma-jumala
toimita hänessä joitakin korjauksia, ei hän varmastikaan tarvitse
minua. Minäkö polttaisin itseni hänen tähtensä! En edes
sormenpäätäni polttaisi, vaikka voisin hänet siten vetää ylös helvetin
syvyyksistä. Ne kaksi vanhaa pappia, jotka minut tähän viettelivät ja
jotka tiesivät, millaista minun oli elää hänen kanssaan, varoivat
visusti sanomasta minulle kaikkea. Mutta ellei Brahma-jumalalla
tosiaankaan ole muuta lahjaa minulle annettavana, kieltäydyn minä
siitä autuudesta. Hyvä herra kuvernööri! Minä rupean
muhamettilaiseksi. Ja mitä teihin tulee", jatkoi hän nuoreen pappiin
katsahtaen, "niin voitte, jos haluatte, mennä sanomaan miehelleni,
että minä voin oikein hyvin".

Pariisissa, 2 p. Chalval-kuuta v. 1718.

127. kirje.

Rica kirjoittaa Usbekille ———:een.

Minä odotan Sinua tänne huomiseksi. Sillä välin lähetän Sinulle


kuitenkin Ispahanista saapuneet kirjeet. Minulle osoitetuissa
kerrotaan, että Suur-Mogulin lähettilään on käsketty poistua
valtakunnasta. Siihen lisätään, että on vangittu prinssi, kuninkaan
setä, jolle hänen kasvatuksensa on ollut uskottuna, ja että hänet on
viety erääseen linnaan, missä häntä vartioidaan hyvin ankarasti,
sitten kun häneltä oli riistetty kaikki hänen arvomerkkinsä. Minua on
liikuttanut tämän prinssin kohtalo, ja minä surkuttelen häntä.

Tunnustan Sinulle, Usbek, etten ole vielä heltymättä nähnyt


kenenkään kyynelten vuotavan. Minä tunnen inhimillistä sääliä
kaikkia onnettomia kohtaan, ikäänkuin vain he olisivat ihmisiä. Ja
maan mahtaviakin, joita kohtaan sydämeni on kova heidän ollessaan
kunnian kukkuloilla, rakastan heidän kukistuttuaan.

Ja mitäpä he tekisivätkään menestyksensä päivinä turhalla


hellyydellä? Sehän lähenee liiaksi tasa-arvoisuutta. He pitävät paljon
enemmän kunnioituksesta, joka ei vaadi vastatunnetta. Mutta sitten
kun he ovat suistuneet suuruutensa korkeuksista, muistuttavat vain
meidän valituksemme siitä heille.

Minusta on jotakin hyvin suorasukaista ja hyvin suurtakin sen


ruhtinaan sanoissa, joka ollessaan vihollistensa käsiin joutumaisillaan
ja nähdessään hoviväkensä itkevän ympärillään, virkkoi heille: "Minä
huomaan kyyneleistänne, että olen vielä kuninkaanne."

Pariisissa, 3 p. Chalval-kuuta v. 1718.

128. kirje.

Rica kirjoittaa Ibbenille Smyrnaan.

Olet kai tuhannetkin kerrat kuullut puhuttavan mainiosta Ruotsin


kuninkaasta. Hän piiritti erästä linnoitusta Norjaksi nimitetyssä
valtakunnassa. Kun hän kahden kesken erään insinöörin kanssa
tarkasti juoksuhautoja, sai hän luodin päähänsä ja kuoli siitä.
Viipymättä vangittiin hänen pääministerinsä. Valtiopäivät
kokoontuivat myös pian ja tuomitsivat hänet menettämään päänsä.

Häntä syytettiin suuresta rikoksesta. Hänen sanottiin herjanneen


kansakuntaa ja riistäneen siltä kuninkaan luottamuksen, mikä
konnamaisuus minunkin mielestäni ansaitsee tuhatkertaisen
kuoleman.

Sillä jos on jo kehnoa mustata ruhtinaan kuullen hänen


halvimmankin alamaisensa kunniaa, niin mitä sitten onkaan, kun
mustataan kokonaisen kansakunnan kunniaa ja ryöstetään siltä sen
ihmisen hyväntahtoisuus, jonka Kaitselmus on pannut luomaan sen
onnen?

Minusta pitäisi ihmisten puhua kuninkaille niinkuin enkelit puhuvat


pyhälle Profeetallemme.

Sinähän tiedät, että minä niissä pyhissä vieraspidoissa, joihin


herrojen herra laskeutuu maailman ylhäisimmältä valtaistuimelta
antautuakseen keskusteluihin orjiensa kanssa, olen ottanut ankaraksi
ohjeekseni tottelemattoman kieleni hillitsemisen. Minun ei ole
milloinkaan kuultu päästävän suustani ainoatakaan sanaa, josta olisi
voinut olla katkeria seurauksia hänen halvimmallekaan alamaiselleen.
Milloin minun on ollut pakko lakata olemasta vähäpuheinen, en ole
koskaan lakannut olemasta kunnian mies. Ja tässä uskollisuutemme
koetuksessa olen kyllä pannut vaaraan henkeni mutta en milloinkaan
kuntoani.

En ymmärrä, mistä johtuu, että tuskin milloinkaan on niin ilkeää


ruhtinasta, ettei hänen ministerinsä ole vielä ilkeämpi. Jos ruhtinas
tekee jonkin pahan työn, tapahtuu se melkein aina yllytyksestä. Siitä
seuraakin, ettei ruhtinaiden kunnianhimo ole milloinkaan niin
vaarallinen kuin heidän neuvonantajiensa halpamaisuus. Mutta
jaksatko Sinä käsittää, että mies, joka vasta eilen pääsi ministeriöön
ja joka ei ehkä enää ole siinä huomenna, saattaa hetkisessä muuttua
itsensä, perheensä, isänmaansa ja niiden sukupolvien viholliseksi,
joita ikuisiin aikoihin asti tulee syntymään hänen sortamansa kansan
keskuudessa?

Ruhtinaalla on intohimoja, mutta ministeri panee ne liikkeelle.


Niiden viittomaan suuntaan hän ohjaa ministerintoimiaan. Hänellä ei
ole muuta päämäärää, eikä hän muusta huolikaan. Hovikot
viettelevät ruhtinasta ylistelyillään, mutta ministeri imartelee häntä
vaarallisemmin neuvoillaan, suunnitelmilla, joita hän tälle tyrkyttää,
ja menettelyohjeilla, joita hän tälle esittelee.

Pariisissa, 25 p. Saphar-kuuta v. 1718.

129. kirje.

Rica kirjoittaa Usbekille ———:een.

Kuljin äskettäin Pont-Neufin yli erään ystävän seurassa. Tämä


tapasi tutun miehen, jota hän sanoi mittausopintutkijaksi. Ja
kaikestapa sen huomasikin, sillä hän oli vaipunut syviin ajatuksiin.
Ystäväni täytyi kiskoa häntä hyvän aikaa hihasta ja pudistella häntä
muutoinkin saadakseen hänet palaamaan tajuihinsa, niin kiintynyt
hän oli käyrään, joka oli kaiketi kiusannut häntä jo yli viikon. He
lausuivat kumpainenkin toisilleen monen monia kohteliaisuuksia ja
kertoivat kumpikin osaltaan kirjallisia uutisia. Nämä juttelut johtivat
heidät erään kahvilan edustalle, ja minäkin menin heidän mukanaan
sisään.

Panin merkille, että kaikki ottivat mittausopin tutkijamme


erinomaisen kunnioittavasti vastaan ja että tarjoilijatkin kiinnittivät
häneen paljon enemmän huomiota kuin kahteen nurkassa istuvaan
muskettisoturiin. Hänestäkin näytti paikka tuntuvan miellyttävältä,
sillä hän oikoi hiukan kasvojensa ryppyjä, jopa puhkesi
nauramaankin, ikäänkuin ei hänellä olisi milloinkaan ollut
pienintäkään vihiä mittausopista.

Kuitenkin hänen säännöllinen järkensä mittaili kaikkea, mitä


keskustelun kuluessa sanottiin. Hän muistutti miestä, joka
puutarhassaan katkoi miekallaan muiden yläpuolelle kohoavien
kukkien päät. Täsmällisyytensä marttyyrinä hän kärsi jokaisesta
keskustelun säännöllisestä tasosta poikkeavasta puheenkäänteestä,
niinkuin herkkä näkö kärsii liian voimakkaasta valaistuksesta. Mikään
ei ollut hänestä samantekevää, kunhan se vain oli totta. Niinpä olikin
hänen haastelunsa varsin kummallista. Hän oli juuri sinä päivänä
saapunut maalta erään miehen seurassa, joka oli nähnyt komean
linnan ja loistavia puutarhalaitoksia: hän oli puolestaan nähnyt vain
kuusikymmentä jalkaa leveän rakennuksen ja epäsäännöllisen neliön
muotoisen, kymmenen auranalaa käsittävän puistikon. Hän olisi
hyvin mielellään suonut perspektiivisääntöjä noudatetun niin tarkoin,
että lehtokujat olisivat näyttäneet joka paikasta yhtä leveiltä. Hän
olisi kyllä neuvonut sitä varten pettämättömän menettelytavan. Hän
näytti erikoisen tyytyväiseltä hyvin omituisesti rakennettuun
aurinkokelloon, jonka hän oli siellä keksinyt. Mutta hän suuttui kovin
erääseen oppineeseen, joka istui minun vieressäni ja kaikeksi
onnettomuudeksi kysyi häneltä, näyttikö se aurinkokello
babylonialaisia tunteja. Kun muuan uutistenmetsästäjä kertoi
Fuenterrabian linnan pommituksesta, esitteli hän meille heti sen
viivan luonteen ja laadun, minkä pommit olivat piirtäneet ilmaan.
Hän oli niin ihastuksissaan siitä tiedostaan, ettei hän halunnut ottaa
lainkaan selkoa pommien vaikutuksesta. Kun eräs toinen oli
valittanut joutuneensa vararikkoon edellisenä talvena sattuneen
tulvan takia, lausahti mittausopintutkijamme: "Se, mitä tuossa
sanoitte, on minusta sangen hauskaa, sillä nyt minä näen, etten
suinkaan erehtynyt havainnoissani, vaan että tänä vuonna on
tosiaankin satanut vähintäin kaksi tuumaa enemmän kuin viime
vuonna."

Hetken kuluttua lähti hän pois, ja me seurasimme häntä, Kun hän


asteli verrattain nopeasti eikä huolinut lainkaan katsella eteensä,
poksahti hän suoraan erääseen toiseen mieheen. Törmäys oli
ankara. Iskusta he kumpikin lennähtivät taholleen vastakkaisessa
suhteessa nopeuteensa ja massaansa. Kun he olivat hiukan
toipuneet typerryksistään, lausui vieras mies mittausopintutkijalle,
käden otsalleen vieden: "Olen hyvin mielissäni siitä, että satuitte
törmäämään minuun, sillä minulla on teille ilmoitettavana suuri
uutinen: minä olen lähettänyt Horatiukseni maailmaan."

"Kuinka?" hämmästyi mittausopin mies. "Hänhän on ollut


maailmassa jo kaksituhatta vuotta."

"Te ette ymmärrä minua", selitti toinen. "Minä olen toimittanut


päivän valoon käännöksen tämän vanhan runoilijan teoksista. Minä
olen jo kahdenkymmenen vuoden ajan puuhaillut pelkkiä
käännöksiä."

"Mitä? hyvä herra", virkkoi mittaustieteilijä. "Kahteenkymmeneen


vuoteen ette siis ole lainkaan ajatellut! Te puhutte muiden puolesta
ja muut ajattelevat teidän puolestanne."

"Hyvä herra", vastasi oppinut, "ettekö sitten usko minun tehneen


yleisölle suurta palvelusta, kun olen tehnyt mainioiden kirjailijain
lukemisen sille helpoksi?"
"Enpä sitä juuri sanoisi. Kunnioitan kyllä siinä kuin joku toinenkin
niitä yleviä neroja, joita puette valepukuun. Mutta te ette pääse
koskaan heidän kaltaisekseen, sillä jos aina käännätte, ei teitä
milloinkaan käännetä.

"Käännökset ovat ikäänkuin kuparirahoja, joilla on kyllä yhteensä


sama arvo kuin yhdellä ainoalla kultarahalla ja ovat mukavampiakin
kansan käytellä. Mutta ne kuluvat aina helposti ja ovat ala-arvoisia
metallipitoisuudeltaan.

"Te tahdotte, sanotte te, saada nämä kuuluisat vainajat


heräämään uuteen eloon keskuudessamme. Minä myönnänkin, että
hankitte heille kyllä ruumiin, mutta elämää ette heihin saa: eläväksi
tekevä henki puuttuu aina."

"Miksi ette mieluummin harrasta niin monen monien kauniiden


totuuksien etsimistä, joita yksinkertainen laskelma paljastaa meille
joka päivä?"

Sitten kun tämä pieni neuvo oli annettu, erosivat he luullakseni


sangen tyytymättöminä toisiinsa.

Pariisissa, toisen Rebiab-kuun viimeisenä päivänä v. 1719.

130. kirje.

Rica kirjoittaa ———:lle.

Tässä kirjeessä aion puhua eräästä kansakunnasta, jota


nimitetään uutisniekoiksi ja joka kerääntyy erääseen loistavaan
puutarhaan, missä heidän toimettomuudellaan on aina jotakin
toimittamista. He ovat sangen hyödyttömiä valtiolle, ja vaikka he
puhua pajattaisivat viisikymmentä vuotta, pysyisivät tulokset
täsmälleen samoina kuin jos he olisivat olleet yhtä pitkän ajan vaiti.
Kuitenkin he luulevat olevansa tärkeitäkin henkilöitä, koska he
keskustelevat loistavista suunnitelmista ja käsittelevät suuria
kysymyksiä.

Heidän keskustelujensa pohjana on kevytmielinen ja naurettava


uteliaisuus. Ei ole niin salaista kammiota, jonne he muka eivät
pääsisi tunkeutumaan. Hehän eivät voisikaan suostua jäämään
tietämättömiksi mistään asiasta. Heillä on täydellisesti selvillä, kuinka
monta vaimoa on korkealla sulttaanillamme ja kuinka monta lasta
hän toimittaa vuosittain maailmaan. Ja vaikka he eivät tuhlaakaan
rahojaan urkkijoihin, tietävät he tyystin, millä keinoin hän aikoo
nöyryyttää turkkilaisten ja mogulien keisarit.

Tuskin he ovat tyhjentäneet nykyisyyden, kun he syöksyvät


tulevaisuuteen. Ja kulkien Kaitselmuksen edellä he ilmoittavat sille
kaikki ihmisten askeleet. He ohjaavat kenraalia kädestä pitäen ja
kehuttuaan häntä tuhansista typeryyksistä, joita hän ei ole tehnyt,
valmistavat hänelle tuhansia muita typeryyksiä, joita hän ei tule
tekemään.

He panevat sotajoukot lentämään kuin kurjet ja muurit kaatumaan


kuin pahvivarustukset. Heillä on sillat yli kaikkien jokien, salaiset tiet
yli kaikkien vuorten ja heillä on suunnattomat varastohuoneet
polttavissa hietaerämaissa. Heiltä ei puutu muuta kuin terve järki.

Asun erään henkilön kanssa, joka sai seuraavan kirjeen tuollaiselta


uutisniekalta. Kun kirje tuntui minusta omituiselta, panin sen talteen.
Kas tällainen se on:
"Hyvä herra!

"Erehdyn harvoin arvaillessani ajan tapahtumia, 1 p.


tammik. v. 1711 minä ennustin keisari Josefin kuolevan sen
vuoden kuluessa. Kun hän jaksoi silloin erinomaisen hyvin,
pelkäsin kyllä joutuvani ihmisten pilkaksi, jos olisin lausunut
ajatukseni aivan selvästi, minkä vuoksi käytinkin hiukan
kaksimielistä sanamuotoa. Mutta ihmiset, jotka osaavat tehdä
johtopäätöksiä, ymmärsivät minua hyvin. Ja 17 p. huhtikuuta
sinä samana vuonna hän kuolikin rokkoon.

"Heti kun keisarin ja turkkilaisten sota oli julistettu,


kiiruhdin etsimään piirimme herroja jäseniä kaikista Tuileries'n
kolkista. Minä keräsin heidät vesialtaan lähettyville ja
ennustin, että Belgradia tultaisiin piirittämään ja että se
valloitettaisiin. Olin niin onnekas, että ennustukseni toteutui.
On kyllä totta, että minä piirityksen kestäessä löin vetoa sata
pistolia siitä, että kaupunki vallattaisiin 18 p. elok. Se vallattiin
kuitenkin vasta seuraavana päivänä. Voidaanko puhua
häviöstä niin kauniissa pelissä?

"Kun kuulin espanjalaisen laivaston laskeneen Sardinian


rannikolle, tein sen johtopäätöksen, että se myös valloittaisi
saaren. Minä sanoin sen, ja niin kävikin. Tämän menestyksen
pöyhistämänä lisäsin, että tämä voittoisa laivasto purjehtisi
Finaleen valloittaakseen Milanon. Kun minun oli vaikea saada
muita hyväksymään tätä ajatusta, tahdoin kannattaa sitä
kunniakkaasti: minä löin vetoa viisikymmentä pistolia ja
menetin ne jälleen. Sillä se paholainen Alberoniksi lähetti
vastoin sopimuksia laivastonsa Sisiliaan ja petti näin yht'aikaa
kahta suurta valtiomiestä, Savoijan herttuaa ja minua.
"Kaikki tämä, hyvä herra, on heittänyt asiani niin sekaisin,
että olen päättänyt aina vain ennustaa enkä lyödä vetoa
milloinkaan. Ennen me emme tunteneetkaan Tuileries'ssa
vedonlyönnin tapaa, eikä kreivi de L——vainaja sitä juuri
sietänytkään. Mutta sitten kun joukko keikareita on
tunkeutunut pariimme, emme enää tiedä, mihin päämme
pistää. Tuskin olemme avanneet suumme kertoaksemme
jonkin uutisen, kun joku tällainen nuorukainen pyrkii lyömään
vetoa sitä vastaan.

"Eräänä päivänä, kun minä jo availin käsikirjoitustani ja


sovittelin silmälaseja nenälleni, käytti muuan tällainen
suupaltti ensimmäisen ja toisen sanan välihetkeä hyväkseen
ja tokaisi: 'Minä lyön sata pistolea vetoa, ettei se ole totta'. En
ollut huomaavinanikaan tuollaista mielettömyyttä, vaan
jatkaen puhettani lujemmalla äänellä lausuin: 'Koska
marsalkka de — — — on saanut tietää…' 'Se on valhetta',
keskeytti hän. 'Teillä on aina niin päättömiä uutisia. Eihän
tässäkään nyt ole minkäänlaista järkeä.'

"Minä pyydän Teitä, hyvä herra, tekemään minulle sen ilon,


että lainaatte minulle kolmekymmentä pistolea, sillä minun
täytyy Teille tunnustaa, että nämä vedot ovat tosiaan
saattaneet minut pahaan pulaan. Samalla lähetän Teille
jäljennöksen kahdesta kirjeestä, jotka olen kirjoittanut
ministerille. Minä olen, jne."

Erään uutisniekan kirjeet ministerille.

"Armollinen herra!
"Minä olen innokkain alamainen, mitä kuninkaalla on
milloinkaan ollut. Minähän sain erään ystävänikin
toteuttamaan tekemäni suunnitelman ja kirjoittamaan kirjan
sen seikan osoittamiseksi ja todistamiseksi, että Ludvig Suuri
oli suurin kaikista ruhtinaista, jotka ovat ansainneet Suuren
nimen. Jo pitkät ajat olen valmistellut itse toista teosta, josta
on oleva vielä enemmän kunniaa kansallemme, jos Teidän
Korkeutenne suvaitsee suoda minulle etuoikeuden.
Tarkoitukseni on todistaa, ettei ranskalaisia aina
kuningaskunnan perustamisesta alkaen ole milloinkaan
voitettu ja että kaikki se, mitä historioitsijat ovat tähän asti
puhuneet meidän tappioistamme, on pelkkää petkutusta.
Minun on pakko oikaista heitä monessa kohdassa, ja minä
uskallankin olla sitä mieltä, että minä loistan varsinkin juuri
arvostelussa. Minä olen, armollinen herra, jne."

"Armollinen herra!

"Kun olemme suureksi tappioksemme menettäneet herra


kreivi de L———in, pyydämme Teitä nöyrimmästi antamaan
suosiollisen lupanne johtajan valitsemiseen. Epäjärjestys
alkaa tunkeutua keskustelukokouksiimme, eikä valtion asioita
pohdita niissä enää yhtä tarkasti kuin ennen. Nuorukaisemme
eivät välitä hituistakaan vanhemmista jäsenistä eivätkä
omassakaan keskuudessaan noudata minkäänlaista kuria: se
on todellinen Rehabeamin neuvoskunta, missä nuorukaiset
tekevät vanhusten sanan tyhjäksi. Meidän on turha
huomauttaa heille, että me pidimme Tuilerioja rauhallisesti
hallussamme jo kaksikymmentä vuotta ennen kuin he olivat
maailmaan tulleetkaan. Pelkäänpä pahoin, että he meidät
vielä sieltä karkottavat ja että meidän on pakko, sitten kun
meidän on ollut poistuttava paikasta, missä olemme usein
mananneet esiin ranskalaisten sankariemme haamuja, väistyä
pitämään keskustelukokouksiamme Kuninkaan Puutarhaan tai
johonkin vielä syrjäisempään soppeen. Minä olen, jne."

Pariisissa, 7 p. toista Gemmadi-kuuta v. 1719.

131. kirje.

Rhedi kirjoittaa Ricalle Pariisiin.

Eurooppaan saavuttuani olen kaikkein suurimmalla uteliaisuudella


koettanut tutkia tasavaltojen syntyä ja historiaa. Sinähän tiedät, ettei
useimmilla aasialaisilla ole edes aavistustakaan sentapaisesta
hallitusmuodosta ja ettei heidän mielikuvituksensa ole kyennyt heille
selvittämään, että maan päällä voi muunlaista hallitusmuotoa
ollakaan kuin itsevaltainen.

Maailman ensimmäiset hallitusmuodot olivat yksinvaltaisia. Vain


sattumalta syntyi vuosisatojen kuluessa tasavaltoja.

Sitten kun Kreikan oli tuhonnut vedenpaisumus, tuli uusia


asukkaita sitä kansoittamaan. Se sai melkein kaikki siirtokuntansa
Egyptistä ja Aasian läheisimmistä seuduista, Ja kun näitä maita
hallitsivat kuninkaat, joutui niistä lähteneille kansoille samanlainen
hallitusmuoto. Mutta kun näiden ruhtinaiden tyrannia kävi liian
raskaaksi, karistivat kansat ikeen hartioiltaan. Ja monien
kuningaskuntien jätteistä kohosivat sitten ne tasavallat, jotka
nostivat Kreikan kauniiseen kukoistukseen ja tekivät siitä ainoan
sivistyneen maan raakalaisten keskelle.

Vapauden rakkaus ja kuningasviha säilytti Kreikan kauan


riippumattomana ja levitti laajalle tasavaltaista hallitusmuotoa.
Kreikkalaiset kaupungit saivat liittolaisia Vähästä Aasiasta. Ne
perustivat sinne siirtokuntia, yhtä vapaita kuin ne itsekin, ja nämä
olivat niiden suojamuureina Persian kuninkaiden yrityksiä vastaan.
Eikä siinä kaikki. Kreikka kansoitti myös Italian ja Italia vuorostaan
Espanjan ja ehkä Galliankin. Tiedetäänhän, että suuri, vanhojen
kirjailijain usein mainitsema Hesperian maa oli alkuaan sama kuin
Kreikka, jota sen naapurit pitivät autuuden asuntona. Kreikkalaiset,
jotka eivät löytäneetkään tätä onnelaa omien rajojensa sisältä,
lähtivät etsimään sitä Italiasta, italialaiset taas Espanjasta,
espanjalaiset Baeticasta tai Portugalista, niin että kaikilla näillä
seuduilla oli tämä nimi vanhojen kirjailijain teoksissa. Nämä
kreikkalaiset siirtokunnat kuljettivat mukanaan sen vapauden
hengen, minkä ne olivat saaneet tästä suloisesta maasta. Niinpä
tuskin nähdäänkään niinä kaukaisina aikoina yksinvaltoja Italiassa,
Espanjassa, Galliassa. Pian tulemme näkemään, että Pohjolan ja
Saksan kansat olivat yhtä vapaita. Jos heidän keskuudestaan
löydettäisiinkin jonkinlaisen kuninkuuden jälkiä, niin johtuu se siitä,
että pidetään kuninkaina sotajoukkojen päälliköitä tai tasavaltojen
esimiehiä.

Kaikki tämä tapahtui Euroopassa, sillä mitä Aasiaan ja Afrikaan


tulee, niin niitä on aina painanut itsevaltius, ellemme ota lukuun
muutamia Vähän Aasian kaupunkeja, joista jo puhuimme, ja
Karthagon tasavaltaa Afrikassa.
Maailman jakoivat keskenään kaksi mahtavaa tasavaltaa: Rooman
ja Karthagon tasavallat. Ei ole mitään niin hyvin tunnettua kuin
Rooman tasavallan alkuvaiheet, eikä mitään niin vähän tunnettua
kuin Karthagon tasavallan synty. Ei tiedetä kerrassaan mitään Didoa
seuranneiden afrikalaisten ruhtinaiden sarjasta eikä siitä, kuinka he
menettivät valtansa. Rooman tasavallan suunnaton laajeneminen
olisi ollut maailmalle suuri onni, ellei olisi ollut kohtuutonta erotusta
Rooman kansalaisten ja voitettujen kansojen välillä, jos olisi annettu
maakuntien käskynhaltijoille pienempi valta, jos heidän tyranniaansa
ehkäiseviä pyhiä lakeja olisi noudatettu ja elleivät he olisi käyttäneet
niiden vaientamiseen samoja aarteita, joita heidän laiton
menettelytapansa oli koonnut.

Tuntuu kuin sopisi vapaus Euroopan kansojen luonteeseen ja


orjuus aasialaisten. Turhaan tarjosivat roomalaiset kappadokialaisille
tätä kallisarvoista aarretta: tämä raukkamainen kansakunta kieltäytyi
siitä ja kiiruhti orjuuden helmaan yhtä innokkaasti kuin muut kansat
pyrkivät vapauteen.

Caesar sorti Rooman tasavaltaa ja pakotti sen tottelemaan


mielivaltaansa.

Eurooppa huokaili kauan väkivaltaisen sotilashallituksen kahleissa,


ja roomalainen lempeys vaihtui julmaan sortoon.

Sillä välin lähti lukemattomia tuntemattomia kansoja Pohjolasta ja


levisi tulvavirtojen tavoin yli Rooman maakuntien. Ja kun ne
huomasivat olevan yhtä helppoa suorittaa valloituksia kuin harjoittaa
ryöstöä, kiskoivat ne maakunnat irti toisistaan ja tekivät niistä
kuningaskuntia. Nämä kansat olivat vapaita ja rajoittivat siihen
määrään kuninkaiden valtaa, että nämä olivat itse asiassa vain niiden
esimiehiä tai sotapäälliköitä. Vaikka nämä kuningaskunnat olikin
perustettu väkivallalla, eivät ne siitä syystä tunteneetkaan voittajan
iestä. Kun Aasian kansat, sellaiset kuin turkkilaiset ja tataarit, tekivät
valloituksia, oli heidän ainoana ajatuksenaan, riippuvaisia kun olivat
yhden ainoan miehen tahdosta, yhä uusien alamaisten toimittaminen
hänelle ja hänen verisen valtansa tukeminen asein. Mutta kun
Pohjolan kansat olivat vapaita jo kotimaastaan lähtiessään, eivät ne
Rooman maakuntiakaan anastaessaan antaneet päälliköilleen kovin
suurta valtaa. Jopa erottivat muutamat tällaiset kansat, niinkuin
Afrikan vandaalit ja Espanjan gootit, kuninkaansa, milloin eivät olleet
heihin tyytyväisiä. Ja toisten keskuudessa oli ruhtinaan valtaa
rajoitettu tuhansin erilaisin tavoin. Suuri joukko ylimyksiä otti sen
käyttelemiseen osaa hänen rinnallaan. Sodat voitiin alkaa vain
heidän suostumuksellaan. Saalis jaettiin päällikön ja soturien kesken.
Ruhtinaalle ei maksettu minkäänlaista veroa. Lait säädettiin kansan
yleisissä kokouksissa. Sellaisia olivat kaikkien näiden Rooman
keisarikunnan sirpaleista muodostuneiden valtioiden perustavat
aatteet.

Venetsiassa, 20 p. Rhegeb-kuuta v. 1719.

132. kirje.

Rica kirjoittaa ———:lle.

Viisi tai kuusi kuukautta sitten olin eräässä kahvilassa. Siellä näin
verrattain hyvin puetun aatelismiehen, jota toiset kuuntelivat. Hän
puhui siitä, kuinka hauskaa oli elää Pariisissa. Hän valitti asemaansa,
hänen kun oli pakko elää maaseudulla. "Minulla on", sanoi hän,
"viidentoistatuhannen livren vuositulot tiluksistani, mutta olisin
luullakseni onnellisempi, jos minulla olisi neljäs osakaan tästä
omaisuudesta rahana tai arvopapereina, joita voi kuljettaa kaikkialle
mukanaan. Turhaan ahdistan vuokraajianikin ja hukutan heidät
oikeuskuluihin: heidän maksukykynsä siitä vain vähenee. En ole vielä
päässyt näkemään sataa pistolea yhdellä kertaa. Jos olisin velkaa
kymmenentuhatta frangia, pantaisiin kaikki tilukseni ryöstöön ja
minä saisin mennä vaivaistaloon."

Poistuin kiinnittämättä sen suurempaa huomiota tähän puheeseen.


Mutta kun eilen osuin jälleen samoille seuduille, poikkesin samaan
taloon. Ja nyt näin siellä totisen miehen, jonka kasvot olivat kalpeat
ja laihtuneet ja joka viiden tai kuuden pakisijan keskellä esiintyi
synkkänä ja mietteliäänä, kunnes hän äkkiä puuttui puheeseen:
"Niin, hyvät herrat", lausui hän ääntänsä ylentäen, "minä olen
hävinnyt mies. Minulla ei ole enää mistä elää. Sillä minulla on
nykyään kaksisataatuhatta livreä pankinsetelejä ja
kolmesataatuhatta frangia muuta rahaa. Minä olen kauheassa
asemassa: luulin olevani rikas ja nyt joudunkin vaivaistaloon. Olisipa
minulla edes tilkkunen maata, minne voisin vetäytyä, niin minulla
olisi varmasti elämisen keinot tiedossa. Mutta minulla ei ole edes niin
suurta maa-aluetta kuin tämän hatun pohja."

Sattumalta käänsin pääni toiseen suuntaan ja näin toisen miehen,


joka väänteli kasvojaan mielettömän tavoin. "Kehen nyt voi enää
luottaa?" huudahti hän. "Muuan petturi, jota pidin niin hyvänä
ystävänäni, että lainasin hänelle rahani, on maksanut ne takaisin!
Mitä inhoittavaa petollisuutta! Tehköön mitä tahansa, minun
silmissäni hän on aina oleva kunniaton olento."

Siinä oli aivan lähellä kolmas hyvin huonosti puettu mies, joka
kohottaen silmänsä taivaaseen sanoi: "Jumala siunatkoon
ministeriemme aivoituksia! Saisinpa nähdä osakkeet
kahdessatuhannessa ja kaikki Pariisin palvelijat isäntiään
rikkaampina!" Uteliaisuuksissani kysyin hänen nimeään. "Hän on
hyvin köyhä mies", vastattiin minulle. "Niinpä hänellä on köyhän
ammattikin: hän on sukujohtojen tutkija. Mutta hän toivoo taitonsa
käyvän tuottavaksi, jos tätä rikkauden heilahtelua jatkuu. Hän uskoo
kaikkien näiden nousukaspohatoiden piankin tarvitsevan häntä, jos
heidän mieli hiukan muovaella nimeänsä, kaapia pahempaa likaa
pois esi-isistään ja koristaa vaunujensa ovia. Hän kuvittelee voivansa
tehdä niin paljon ylhäistä väkeä kuin vain viitsii ja on aivan
haltioissaan ilosta, kun näkee asiakkaittensa luvun näin lisääntyvän."

Vihdoin näin astuvan sisään erään kalpean ja kuivan vanhuksen,


jonka arvasin uutisniekaksi ennen kuin hän oli ennättänyt
istuutuakaan. Hän ei kuulunut niihin, jotka voitokkaalla varmuudella
kohtaavat kaikkia kovan onnea kolauksia ja jotka aina vain
ennustavat menestystä ja voittosaalista. Hän oli päinvastoin niitä
vapisijoita, joilla on vain surullisia uutisia. "Asiat käyvät aina päin
mäntyyn Espanjan puolessa", kertoi hän. "Meillä ei ole lainkaan
ratsuväkeä rajalla, ja pelättävissä on, että prinssi Pio, jolla sitä on
kokonainen suuri joukko-osasto, ottaa paloveroa koko
Languedocista." Vastapäätä minua istui muuan filosofi, jonka ulkoasu
oli verrattain huonossa järjestyksessä ja joka sääli uutisniekkaa,
kohotellen hartioitaan sitä mukaa kuin toinen korotti ääntään.
Asetuin hänen viereensä, ja hän kuiskasi korvaani: "Tehän olette
kuullut tuon narrin jo kokonaisen tunnin ajan loruilevan meille
Languedocin pelostaan. Minä keksin eilen illalla auringossa pilkun,
joka, jos se leviää, saattaa kohmetuttaa koko luonnon. Mutta minä,
minä en ole lausunut sanaakaan."

Pariisissa, 17 p. Rhamazan-kuuta v. 1719.


133. kirje.

Rica kirjoittaa ———:lle.

Äskettäin kävin katsomassa erästä suurta kirjastoa, joka oli


sijoitettu dervishien luostariin. Dervishit ovat ikäänkuin sen vartijoita
ja hoitajia, mutta he ovat velvollisia päästämään sinne yleisöäkin
määrättyinä tunteina.

Sisään astuessani näin erään vakavan miehen kävelevän


lukemattomien niteiden keskellä, jotka ympäröivät häntä joka
puolelta. Menin hänen luokseen ja pyysin häntä sanomaan, mitä
olivat eräät muita paremmin sidotut kirjat. "Hyvä herra", vastasi hän,
"asun täällä vieraassa maassa: minä en tunne täällä ketään. Monet
ihmiset tekevät minulle samanlaisia kysymyksiä. Mutta
ymmärtänettehän, etten minä suinkaan saata lähteä lukemaan
kaikkia näitä kirjoja kyetäkseni heidän uteliaisuuttaan tyydyttämään.
Täällä on kyllä kirjastonhoitaja, joka antaa teille haluamanne tiedot,
sillä hän uhraa yöt ja päivät kaiken sen tutkistelemiseen, mitä tuossa
näette. Hän on mies, joka ei kelpaa mihinkään muuhun ja josta
meille on vain suurta haittaa, koska hän ei tee työtä luostarin
hyväksi. Mutta ruokakello kuuluu soivan. Niiden, jotka minun
tavallani johtavat veljeskuntaa, täytyy olla ensimmäisiä kaikissa
toimituksissa." Näin sanoen munkki työnsi minut ulos, sulki oven ja
katosi kuin lentämällä näkyvistäni.

Pariisissa, 21 p. Rhamazan-kuuta v. 1719.

134. kirje.
Rica kirjoittaa samalle.

Seuraavana päivänä palasin tähän kirjastoon, missä nyt tapasin


aivan toisen miehen kuin ensi kerralla näkemäni. Hänen ulkoasunsa
oli vaatimaton, hänen kasvonilmeensä henkevät ja hänen
käyttäytymisensä hyvin herttainen. Heti kun olin puhunut hänelle
uteliaisuudestani, kävi hän sitä tyydyttämään, jopa, kun olin
ulkomaalainen, minua aivan erikoisesti valistamaankin.

"Arvoisa isä", sanoin hänelle, "mitä ovat nämä paksut niteet, jotka
täyttävät koko tämän puolen kirjastoa?"

"Ne ovat Pyhän Kirjan selityksiä", vastasi hän.

"Onpa niitä paljon!" ihmettelin minä. "Pyhä Kirja oli varmaankin


hyvin hämärä muinaisina aikoina, mutta nyt se näyttää olevan hyvin
selvä. Onko vielä olemassa epäilyksiä? Saattaako olla olemassa
kiisteltyjä kohtia?"

"Onko niitä olemassa, hyvä Jumala! Onko niitä olemassa!"


huudahti hän. "Niitä on melkein yhtä paljon kuin rivejä."

"Niinkö?" vastasin minä. "Entä mitä kaikki nämä kynäniekat ovat


sitten tehneet?"

"Nämä kynäniekat", selitti hän, "eivät ole suinkaan etsineet


Pyhästä Raamatusta sitä, mitä tulee uskoa, vaan sitä, mitä he itse
uskovat. He eivät ole sitä pitäneet kirjana, johon sisältyvät heidänkin
tunnustettavikseen aiotut opinkappaleet, vaan teoksena, josta sopi
penkoa vahvistusta heidän omille mielipiteilleen. Siitä syystä he ovat
vääntäneet kaikki sen ajatukset ja pitäneet pihdeissään kaikkia sen
lausumia. Se on maa, mihin kaikkien lahkojen kannattajat
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