You are on page 1of 53

Supercharged Python Take Your Code

to the Next Level Brian Overland


Visit to download the full and correct content document:
https://textbookfull.com/product/supercharged-python-take-your-code-to-the-next-leve
l-brian-overland/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

Python Real World Machine Learning: Real World Machine


Learning: Take your Python Machine learning skills to
the next level 1st Edition Joshi

https://textbookfull.com/product/python-real-world-machine-
learning-real-world-machine-learning-take-your-python-machine-
learning-skills-to-the-next-level-1st-edition-joshi/

Python Without Fear 1st Edition Brian Overland

https://textbookfull.com/product/python-without-fear-1st-edition-
brian-overland/

Advanced Persistent Training : Take Your Security


Awareness Program to the Next Level 1st Edition Jordan
Schroeder

https://textbookfull.com/product/advanced-persistent-training-
take-your-security-awareness-program-to-the-next-level-1st-
edition-jordan-schroeder/

Exploring Tunisian Crochet All the Basics plus Stitches


and Techniques to Take Your Crochet to the Next Level
Lori Harrison

https://textbookfull.com/product/exploring-tunisian-crochet-all-
the-basics-plus-stitches-and-techniques-to-take-your-crochet-to-
the-next-level-lori-harrison/
Mastering Linux Administration : Take your sysadmin
skills to the next level by configuring and maintaining
Linux systems 2nd Edition Alexandru Calcatinge & Julian
Balog
https://textbookfull.com/product/mastering-linux-administration-
take-your-sysadmin-skills-to-the-next-level-by-configuring-and-
maintaining-linux-systems-2nd-edition-alexandru-calcatinge-
julian-balog/

Teach Your Kids to Code A Parent Friendly Guide to


Python Programming 1st Edition Bryson Payne

https://textbookfull.com/product/teach-your-kids-to-code-a-
parent-friendly-guide-to-python-programming-1st-edition-bryson-
payne/

The Bartering Mindset A Mostly Forgotten Framework for


Mastering Your Next Negotiation Brian C. Gunia

https://textbookfull.com/product/the-bartering-mindset-a-mostly-
forgotten-framework-for-mastering-your-next-negotiation-brian-c-
gunia/

Begin to Code with Python Rob Miles

https://textbookfull.com/product/begin-to-code-with-python-rob-
miles/

Mastering Large Datasets with Python Parallelize and


Distribute Your Python Code 1st Edition John T Wolohan

https://textbookfull.com/product/mastering-large-datasets-with-
python-parallelize-and-distribute-your-python-code-1st-edition-
john-t-wolohan/
About This eBook
ePUB is an open, industry-standard format for eBooks.
However, support of ePUB and its many features varies across
reading devices and applications. Use your device or app
settings to customize the presentation to your liking. Settings
that you can customize often include font, font size, single or
double column, landscape or portrait mode, and figures that
you can click or tap to enlarge. For additional information about
the settings and features on your reading device or app, visit the
device manufacturer’s Web site.

Many titles include programming code or configuration


examples. To optimize the presentation of these elements, view
the eBook in single-column, landscape mode and adjust the font
size to the smallest setting. In addition to presenting code and
configurations in the reflowable text format, we have included
images of the code that mimic the presentation found in the
print book; therefore, where the reflowable format may
compromise the presentation of the code listing, you will see a
“Click here to view code image” link. Click the link to view the
print-fidelity code image. To return to the previous page viewed,
click the Back button on your device or app.
Supercharged Python
Supercharged Python
Brian Overland

John Bennett

Boston • Columbus • New York • San Francisco • Amsterdam •


Cape Town
Dubai • London • Madrid • Milan • Munich • Paris • Montreal •
Toronto • Delhi • Mexico City
São Paulo • Sydney • Hong Kong • Seoul • Singapore • Taipei •
Tokyo
Many of the designations used by manufacturers and sellers to
distinguish their products are claimed as trademarks. Where
those designations appear in this book, and the publisher was
aware of a trademark claim, the designations have been printed
with initial capital letters or in all capitals.

The authors and publisher have taken care in the preparation of


this book, but make no expressed or implied warranty of any
kind and assume no responsibility for errors or omissions. No
liability is assumed for incidental or consequential damages in
connection with or arising out of the use of the information or
programs contained herein.

For information about buying this title in bulk quantities, or for


special sales opportunities (which may include electronic
versions; custom cover designs; and content particular to your
business, training goals, marketing focus, or branding
interests), please contact our corporate sales department at
corpsales@pearsoned.com or (800) 382-3419.

For government sales inquiries, please contact


governmentsales@pearsoned.com.

For questions about sales outside the U.S., please contact


intlcs@pearson.com.

Visit us on the Web: informit.com/aw

Library of Congress Control Number: 2019936408

Copyright © 2019 Pearson Education, Inc.

Cover illustration: Open Studio/Shutterstock


All rights reserved. This publication is protected by copyright,
and permission must be obtained from the publisher prior to
any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic,
mechanical, photocopying, recording, or likewise. For
information regarding permissions, request forms and the
appropriate contacts within the Pearson Education Global
Rights & Permissions Department, please visit
www.pearsoned.com/permissions/.

ISBN-13: 978-0-13-515994-1

ISBN-10: 0-13-515994-6

1 19
To my beautiful and brilliant mother, Betty P. M. Overland. . . .

All the world is mad except for me and thee. Stay a little.

—Brian

To my parents, who did so much to shape who I am.

—John
Contents
Preface

What Makes Python Special?

Paths to Learning: Where Do I Start?

Clarity and Examples Are Everything

Learning Aids: Icons

What You’ll Learn

Have Fun

Acknowledgments

About the Authors

Chapter 1 Review of the Fundamentals

1.1 Python Quick Start

1.2 Variables and Naming Names

1.3 Combined Assignment Operators

1.4 Summary of Python Arithmetic Operators

1.5 Elementary Data Types: Integer and Floating Point

1.6 Basic Input and Output


1.7 Function Definitions

1.8 The Python “if” Statement

1.9 The Python “while” Statement

1.10 A Couple of Cool Little Apps

1.11 Summary of Python Boolean Operators

1.12 Function Arguments and Return Values

1.13 The Forward Reference Problem

1.14 Python Strings

1.15 Python Lists (and a Cool Sorting App)

1.16 The “for” Statement and Ranges

1.17 Tuples

1.18 Dictionaries

1.19 Sets

1.20 Global and Local Variables

Summary

Review Questions

Suggested Problems

Chapter 2 Advanced String Capabilities

2.1 Strings Are Immutable


2.2 Numeric Conversions, Including Binary

2.3 String Operators (+, =, *, >, etc.)

2.4 Indexing and Slicing

2.5 Single-Character Functions (Character Codes)

2.6 Building Strings Using “join”

2.7 Important String Functions

2.8 Binary, Hex, and Octal Conversion Functions

2.9 Simple Boolean (“is”) Methods

2.10 Case Conversion Methods

2.11 Search-and-Replace Methods

2.12 Breaking Up Input Using “split”

2.13 Stripping

2.14 Justification Methods

Summary

Review Questions

Suggested Problems

Chapter 3 Advanced List Capabilities

3.1 Creating and Using Python Lists

3.2 Copying Lists Versus Copying List Variables


3.3 Indexing

3.3.1 Positive Indexes

3.3.2 Negative Indexes

3.3.3 Generating Index Numbers Using “enumerate”

3.4 Getting Data from Slices

3.5 Assigning into Slices

3.6 List Operators

3.7 Shallow Versus Deep Copying

3.8 List Functions

3.9 List Methods: Modifying a List

3.10 List Methods: Getting Information on Contents

3.11 List Methods: Reorganizing

3.12 Lists as Stacks: RPN Application

3.13 The “reduce” Function

3.14 Lambda Functions

3.15 List Comprehension

3.16 Dictionary and Set Comprehension

3.17 Passing Arguments Through a List

3.18 Multidimensional Lists


3.18.1 Unbalanced Matrixes

3.18.2 Creating Arbitrarily Large Matrixes

Summary

Review Questions

Suggested Problems

Chapter 4 Shortcuts, Command Line, and Packages

4.1 Overview

4.2 Twenty-Two Programming Shortcuts

4.2.1 Use Python Line Continuation as Needed

4.2.2 Use “for” Loops Intelligently

4.2.3 Understand Combined Operator Assignment (+= etc.)

4.2.4 Use Multiple Assignment

4.2.5 Use Tuple Assignment

4.2.6 Use Advanced Tuple Assignment

4.2.7 Use List and String “Multiplication”

4.2.8 Return Multiple Values

4.2.9 Use Loops and the “else” Keyword

4.2.10 Take Advantage of Boolean Values and “not”

4.2.11 Treat Strings as Lists of Characters


4.2.12 Eliminate Characters by Using “replace”

4.2.13 Don’t Write Unnecessary Loops

4.2.14 Use Chained Comparisons (n < x < m)

4.2.15 Simulate “switch” with a Table of Functions

4.2.16 Use the “is” Operator Correctly

4.2.17 Use One-Line “for” Loops

4.2.18 Squeeze Multiple Statements onto a Line

4.2.19 Write One-Line if/then/else Statements

4.2.20 Create Enum Values with “range”

4.2.21 Reduce the Inefficiency of the “print” Function Within


IDLE

4.2.22 Place Underscores Inside Large Numbers

4.3 Running Python from the Command Line

4.3.1 Running on a Windows-Based System

4.3.2 Running on a Macintosh System

4.3.3 Using pip or pip3 to Download Packages

4.4 Writing and Using Doc Strings

4.5 Importing Packages

4.6 A Guided Tour of Python Packages


4.7 Functions as First-Class Objects

4.8 Variable-Length Argument Lists

4.8.1 The *args List

4.8.2 The “**kwargs” List

4.9 Decorators and Function Profilers

4.10 Generators

4.10.1 What’s an Iterator?

4.10.2 Introducing Generators

4.11 Accessing Command-Line Arguments

Summary

Questions for Review

Suggested Problems

Chapter 5 Formatting Text Precisely

5.1 Formatting with the Percent Sign Operator (%)

5.2 Percent Sign (%) Format Specifiers

5.3 Percent Sign (%) Variable-Length Print Fields

5.4 The Global “format” Function

5.5 Introduction to the “format” Method

5.6 Ordering by Position (Name or Number)


5.7 “Repr” Versus String Conversion

5.8 The “spec” Field of the “format” Function and Method

5.8.1 Print-Field Width

5.8.2 Text Justification: “fill” and “align” Characters

5.8.3 The “sign” Character

5.8.4 The Leading-Zero Character (0)

5.8.5 Thousands Place Separator

5.8.6 Controlling Precision

5.8.7 “Precision” Used with Strings (Truncation)

5.8.8 “Type” Specifiers

5.8.9 Displaying in Binary Radix

5.8.10 Displaying in Octal and Hex Radix

5.8.11 Displaying Percentages

5.8.12 Binary Radix Example

5.9 Variable-Size Fields

Summary

Review Questions

Suggested Problems

Chapter 6 Regular Expressions, Part I


6.1 Introduction to Regular Expressions

6.2 A Practical Example: Phone Numbers

6.3 Refining Matches

6.4 How Regular Expressions Work: Compiling Versus Running

6.5 Ignoring Case, and Other Function Flags

6.6 Regular Expressions: Basic Syntax Summary

6.6.1 Meta Characters

6.6.2 Character Sets

6.6.3 Pattern Quantifiers

6.6.4 Backtracking, Greedy, and Non-Greedy

6.7 A Practical Regular-Expression Example

6.8 Using the Match Object

6.9 Searching a String for Patterns

6.10 Iterative Searching (“findall”)

6.11 The “findall” Method and the Grouping Problem

6.12 Searching for Repeated Patterns

6.13 Replacing Text

Summary

Review Questions
Suggested Problems

Chapter 7 Regular Expressions, Part II

7.1 Summary of Advanced RegEx Grammar

7.2 Noncapture Groups

7.2.1 The Canonical Number Example

7.2.2 Fixing the Tagging Problem

7.3 Greedy Versus Non-Greedy Matching

7.4 The Look-Ahead Feature

7.5 Checking Multiple Patterns (Look-Ahead)

7.6 Negative Look-Ahead

7.7 Named Groups

7.8 The “re.split” Function

7.9 The Scanner Class and the RPN Project

7.10 RPN: Doing Even More with Scanner

Summary

Review Questions

Suggested Problems

Chapter 8 Text and Binary Files

8.1 Two Kinds of Files: Text and Binary


8.1.1 Text Files

8.1.2 Binary Files

8.2 Approaches to Binary Files: A Summary

8.3 The File/Directory System

8.4 Handling File-Opening Exceptions

8.5 Using the “with” Keyword

8.6 Summary of Read/Write Operations

8.7 Text File Operations in Depth

8.8 Using the File Pointer (“seek”)

8.9 Reading Text into the RPN Project

8.9.1 The RPN Interpreter to Date

8.9.2 Reading RPN from a Text File

8.9.3 Adding an Assignment Operator to RPN

8.10 Direct Binary Read/Write

8.11 Converting Data to Fixed-Length Fields (“struct”)

8.11.1 Writing and Reading One Number at a Time

8.11.2 Writing and Reading Several Numbers at a Time

8.11.3 Writing and Reading a Fixed-Length String

8.11.4 Writing and Reading a Variable-Length String


8.11.5 Writing and Reading Strings and Numerics Together

8.11.6 Low-Level Details: Big Endian Versus Little Endian

8.12 Using the Pickling Package

8.13 Using the “shelve” Package

Summary

Review Questions

Suggested Problems

Chapter 9 Classes and Magic Methods

9.1 Classes and Objects: Basic Syntax

9.2 More About Instance Variables

9.3 The “_ _init_ _” and “_ _new_ _” Methods

9.4 Classes and the Forward Reference Problem

9.5 Methods Generally

9.6 Public and Private Variables and Methods

9.7 Inheritance

9.8 Multiple Inheritance

9.9 Magic Methods, Summarized

9.10 Magic Methods in Detail

9.10.1 String Representation in Python Classes


9.10.2 The Object Representation Methods

9.10.3 Comparison Methods

9.10.4 Arithmetic Operator Methods

9.10.5 Unary Arithmetic Methods

9.10.6 Reflection (Reverse-Order) Methods

9.10.7 In-Place Operator Methods

9.10.8 Conversion Methods

9.10.9 Collection Class Methods

9.10.10 Implementing “_ _iter_ _” and “_ _next_ _”

9.11 Supporting Multiple Argument Types

9.12 Setting and Getting Attributes Dynamically

Summary

Review Questions

Suggested Problems

Chapter 10 Decimal, Money, and Other Classes

10.1 Overview of Numeric Classes

10.2 Limitations of Floating-Point Format

10.3 Introducing the Decimal Class

10.4 Special Operations on Decimal Objects


10.5 A Decimal Class Application

10.6 Designing a Money Class

10.7 Writing the Basic Money Class (Containment)

10.8 Displaying Money Objects (“_ _str_ _”, “_ _repr_ _”)

10.9 Other Monetary Operations

10.10 Demo: A Money Calculator

10.11 Setting the Default Currency

10.12 Money and Inheritance

10.13 The Fraction Class

10.14 The Complex Class

Summary

Review Questions

Suggested Problems

Chapter 11 The Random and Math Packages

11.1 Overview of the Random Package

11.2 A Tour of Random Functions

11.3 Testing Random Behavior

11.4 A Random-Integer Game

11.5 Creating a Deck Object


11.6 Adding Pictograms to the Deck

11.7 Charting a Normal Distribution

11.8 Writing Your Own Random-Number Generator

11.8.1 Principles of Generating Random Numbers

11.8.2 A Sample Generator

11.9 Overview of the Math Package

11.10 A Tour of Math Package Functions

11.11 Using Special Values (pi)

11.12 Trig Functions: Height of a Tree

11.13 Logarithms: Number Guessing Revisited

11.13.1 How Logarithms Work

11.13.2 Applying a Logarithm to a Practical Problem

Summary

Review Questions

Suggested Problems

Chapter 12 The “numpy” (Numeric Python) Package

12.1 Overview of the “array,” “numpy,” and “matplotlib”


Packages

12.1.1 The “array” Package


12.1.2 The “numpy” Package

12.1.3 The “numpy.random” Package

12.1.4 The “matplotlib” Package

12.2 Using the “array” Package

12.3 Downloading and Importing “numpy”

12.4 Introduction to “numpy”: Sum 1 to 1 Million

12.5 Creating “numpy” Arrays

12.5.1 The “array” Function (Conversion to an Array)

12.5.2 The “arange” Function

12.5.3 The “linspace” Function

12.5.4 The “empty” Function

12.5.5 The “eye” Function

12.5.6 The “ones” Function

12.5.7 The “zeros” Function

12.5.8 The “full” Function

12.5.9 The “copy” Function

12.5.10 The “fromfunction” Function

12.6 Example: Creating a Multiplication Table

12.7 Batch Operations on “numpy” Arrays


12.8 Ordering a Slice of “numpy”

12.9 Multidimensional Slicing

12.10 Boolean Arrays: Mask Out That “numpy”!

12.11 “numpy” and the Sieve of Eratosthenes

12.12 Getting “numpy” Stats (Standard Deviation)

12.13 Getting Data on “numpy” Rows and Columns

Summary

Review Questions

Suggested Problems

Chapter 13 Advanced Uses of “numpy”

13.1 Advanced Math Operations with “numpy”

13.2 Downloading “matplotlib”

13.3 Plotting Lines with “numpy” and “matplotlib”

13.4 Plotting More Than One Line

13.5 Plotting Compound Interest

13.6 Creating Histograms with “matplotlib”

13.7 Circles and the Aspect Ratio

13.8 Creating Pie Charts

13.9 Doing Linear Algebra with “numpy”


13.9.1 The Dot Product

13.9.2 The Outer-Product Function

13.9.3 Other Linear Algebra Functions

13.10 Three-Dimensional Plotting

13.11 “numpy” Financial Applications

13.12 Adjusting Axes with “xticks” and “yticks”

13.13 “numpy” Mixed-Data Records

13.14 Reading and Writing “numpy” Data from Files

Summary

Review Questions

Suggested Problems

Chapter 14 Multiple Modules and the RPN Example

14.1 Overview of Modules in Python

14.2 Simple Two-Module Example

14.3 Variations on the “import” Statement

14.4 Using the “_ _all_ _” Symbol

14.5 Public and Private Module Variables

14.6 The Main Module and “_ _main_ _”

14.7 Gotcha! Problems with Mutual Importing


14.8 RPN Example: Breaking into Two Modules

14.9 RPN Example: Adding I/O Directives

14.10 Further Changes to the RPN Example

14.10.1 Adding Line-Number Checking

14.10.2 Adding Jump-If-Not-Zero

14.10.3 Greater-Than (>) and Get-Random-Number (!)

14.11 RPN: Putting It All Together

Summary

Review Questions

Suggested Problems

Chapter 15 Getting Financial Data off the Internet

15.1 Plan of This Chapter

15.2 Introducing the Pandas Package

15.3 “stock_load”: A Simple Data Reader

15.4 Producing a Simple Stock Chart

15.5 Adding a Title and Legend

15.6 Writing a “makeplot” Function (Refactoring)

15.7 Graphing Two Stocks Together

15.8 Variations: Graphing Other Data


15.9 Limiting the Time Period

15.10 Split Charts: Subplot the Volume

15.11 Adding a Moving-Average Line

15.12 Giving Choices to the User

Summary

Review Questions

Suggested Problems

Appendix A Python Operator Precedence Table

Appendix B Built-In Python Functions

abs(x)

all(iterable)

any(iterable)

ascii(obj)

bin(n)

bool(obj)

bytes(source, encoding)

callable(obj)

chr(n)
compile(cmd_str, filename, mode_str, flags=0,
dont_inherit=False, optimize=–1)

complex(real=0, imag=0)

complex(complex_str)

delattr(obj, name_str)

dir([obj])

divmod(a, b)

enumerate(iterable, start=0)

eval(expr_str [, globals [, locals]] )

exec(object [,global [,locals]])

filter(function,iterable)

float([x])

format(obj, [format_spec])

frozenset([iterable])

getattr(obj,name_str [,default])

globals()

hasattr(obj,name_str)

hash(obj)

help([obj])
hex(n)

id(obj)

input([prompt_str])

int(x,base=10)

int()

isinstance(obj,class)

issubclass(class1,class2)

iter(obj)

len(sequence)

list([iterable])

locals()

map(function,iterable1 [,iterable2...])

max(arg1 [, arg2]...)

max(iterable)

min(arg1 [, arg2]...)

min(iterable)

oct(n)

open(file_name_str,mode=‘rt’)

ord(char_str)
Another random document with
no related content on Scribd:
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund from
the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law in
the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name
associated with the work. You can easily comply with the terms of
this agreement by keeping this work in the same format with its
attached full Project Gutenberg™ License when you share it without
charge with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the terms
of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears, or
with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning of
this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1 with
active links or immediate access to the full terms of the Project
Gutenberg™ License.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or expense
to the user, provide a copy, a means of exporting a copy, or a means
of obtaining a copy upon request, of the work in its original “Plain
Vanilla ASCII” or other form. Any alternate format must include the
full Project Gutenberg™ License as specified in paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive from
the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt that
s/he does not agree to the terms of the full Project Gutenberg™
License. You must require such a user to return or destroy all
copies of the works possessed in a physical medium and
discontinue all use of and all access to other copies of Project
Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except


for the “Right of Replacement or Refund” described in paragraph
1.F.3, the Project Gutenberg Literary Archive Foundation, the owner
of the Project Gutenberg™ trademark, and any other party
distributing a Project Gutenberg™ electronic work under this
agreement, disclaim all liability to you for damages, costs and
expenses, including legal fees. YOU AGREE THAT YOU HAVE NO
REMEDIES FOR NEGLIGENCE, STRICT LIABILITY, BREACH OF
WARRANTY OR BREACH OF CONTRACT EXCEPT THOSE
PROVIDED IN PARAGRAPH 1.F.3. YOU AGREE THAT THE
FOUNDATION, THE TRADEMARK OWNER, AND ANY
DISTRIBUTOR UNDER THIS AGREEMENT WILL NOT BE LIABLE
TO YOU FOR ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL,
PUNITIVE OR INCIDENTAL DAMAGES EVEN IF YOU GIVE
NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving it,
you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or entity
that provided you with the defective work may elect to provide a
replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth in
paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.
1.F.6. INDEMNITY - You agree to indemnify and hold the
Foundation, the trademark owner, any agent or employee of the
Foundation, anyone providing copies of Project Gutenberg™
electronic works in accordance with this agreement, and any
volunteers associated with the production, promotion and distribution
of Project Gutenberg™ electronic works, harmless from all liability,
costs and expenses, including legal fees, that arise directly or
indirectly from any of the following which you do or cause to occur:
(a) distribution of this or any Project Gutenberg™ work, (b)
alteration, modification, or additions or deletions to any Project
Gutenberg™ work, and (c) any Defect you cause.

Section 2. Information about the Mission of


Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many small
donations ($1 to $5,000) are particularly important to maintaining tax
exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About Project


Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.

Project Gutenberg™ eBooks are often created from several printed


editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
back
back
back
back
back
back
back
back
back

You might also like