100% found this document useful (1 vote)
59 views

Python 101 Second Edition 2nd Edition Michael Driscoll instant download

The document provides information about the book 'Python 101 Second Edition' by Michael Driscoll, which covers the basics and intermediate topics of Python programming. It includes a detailed table of contents outlining various chapters on Python language features, practical applications, and distribution methods. Additionally, it offers links to download the book and other related resources on ebookbell.com.

Uploaded by

banarkendizm
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 (1 vote)
59 views

Python 101 Second Edition 2nd Edition Michael Driscoll instant download

The document provides information about the book 'Python 101 Second Edition' by Michael Driscoll, which covers the basics and intermediate topics of Python programming. It includes a detailed table of contents outlining various chapters on Python language features, practical applications, and distribution methods. Additionally, it offers links to download the book and other related resources on ebookbell.com.

Uploaded by

banarkendizm
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/ 77

Python 101 Second Edition 2nd Edition Michael

Driscoll download

https://ebookbell.com/product/python-101-second-edition-2nd-
edition-michael-driscoll-21982810

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Python 101 Learn The Python Basics In 14 Days Ricardo Reid Casey
Gerena

https://ebookbell.com/product/python-101-learn-the-python-basics-
in-14-days-ricardo-reid-casey-gerena-36861352

Python 101 Michael Driscoll

https://ebookbell.com/product/python-101-michael-driscoll-42922582

Python 101 Michael Driscoll

https://ebookbell.com/product/python-101-michael-driscoll-5565234

Python 101 2nd Michael Driscoll

https://ebookbell.com/product/python-101-2nd-michael-driscoll-11529998
Python 101 2nd Michael Driscoll

https://ebookbell.com/product/python-101-2nd-michael-driscoll-11530036

Geospatial Data Science Essentials 101 Practical Python Tips And


Tricks Milan Janosov

https://ebookbell.com/product/geospatial-data-science-
essentials-101-practical-python-tips-and-tricks-milan-janosov-59151212

1 Dataset 101 Visualizations Using Python Abouraia A

https://ebookbell.com/product/1-dataset-101-visualizations-using-
python-abouraia-a-55797198

1 Dataset 101 Visualizations Using Python Ahmed Abouraia

https://ebookbell.com/product/1-dataset-101-visualizations-using-
python-ahmed-abouraia-55711574

Programming Arcgis 101 With Python Cookbook Eric Pimpler

https://ebookbell.com/product/programming-arcgis-101-with-python-
cookbook-eric-pimpler-4443094
Python 101
2nd Edition

Michael Driscoll

This book is for sale at http://leanpub.com/py101

This version was published on 2020-08-29

* * * * *

This is a Leanpub book. Leanpub empowers authors and publishers with the
Lean Publishing process. Lean Publishing is the act of publishing an in-
progress ebook using lightweight tools and many iterations to get reader
feedback, pivot until you have the right book and build traction once you
do.

* * * * *

© 2020 Michael Driscoll


Table of Contents
About the Technical Reviewers
Ethan Furman
Martin Breuss
Acknowledgments
Introduction
Part I - The Basics
Part II - Intermediate Materials
Part III - Tutorials
Part IV - Python Packaging and Distribution
Target Audience
About the Author
Conventions
Requirements
Book Source Code
Reader Feedback
Errata
Part I - The Python Language
Chapter 1 - Installing Python
Installing on Windows
Installing on Mac
Installing on Linux
Android / iOS
Other Operating Systems
Other Python Variants
Wrapping Up
Chapter 2 - Python Editors
What About the REPL?
Getting Started with IDLE
Getting Started with PyCharm Community Edition
Getting Started with Wing Personal
Getting Started with Visual Studio Code
Wrapping Up
Chapter 3 - Documenting Your Code
What are Comments?
Commenting Out
Multiline Comments
Learning About docstrings
Python’s Style Guide: PEP8
Tools that can help
Wrapping Up
Review Questions
Chapter 4 - Working with Strings
Creating Strings
String Methods
String Formatting
Formatting Strings Using %s (printf-style)
Formatting Strings Using .format()
Formatting Strings with f-strings
String Concatenation
String Slicing
Wrapping Up
Review Questions
Chapter 5 - Numeric Types
Integers
Floats
Complex Numbers
Numeric Operations
Augmented Assignment
Wrapping Up
Review Questions
Chapter 6 - Learning About Lists
Creating Lists
List Methods
List Slicing
Copying a List
Wrapping Up
Review Questions
Chapter 7 - Learning About Tuples
Creating Tuples
Working With Tuples
Concatenating Tuples
Special Case Tuples
Wrapping Up
Review Questions
Chapter 8 - Learning About Dictionaries
Creating Dictionaries
Accessing Dictionaries
Dictionary Methods
Modifying Your Dictionary
Deleting Items From Your Dictionary
Wrapping Up
Review Questions
Chapter 9 - Learning About Sets
Creating a Set
Accessing Set Members
Changing Items
Adding Items
Removing Items
Clearing or Deleting a Set
Set Operations
Wrapping Up
Review Questions
Chapter 10 - Boolean Operations and None
The bool() Function
What About None?
Wrapping Up
Review Questions
Chapter 11 - Conditional Statements
Comparison Operators
Creating a Simple Conditional
Branching Conditional Statements
Nesting Conditionals
Logical Operators
Special Operators
Wrapping Up
Review Questions
Chapter 12 - Learning About Loops
Creating a for Loop
Looping Over a String
Looping Over a Dictionary
Extracting Multiple Values in a Tuple While Looping
Using enumerate with Loops
Creating a while Loop
Breaking Out of a Loop
Using continue
Loops and the else Statement
Nesting Loops
Wrapping Up
Review Questions
Chapter 13 - Python Comprehensions
List Comprehensions
Nested List Comprehensions
Dictionary Comprehensions
Set Comprehensions
Wrapping Up
Review Questions
Chapter 14 - Exception Handling
The Most Common Exceptions
Handling Exceptions
Raising Exceptions
Examining the Exception Object
Using the finally Statement
Using the else Statement
Wrapping Up
Review Questions
Chapter 15 - Working with Files
The open() Function
Reading Files
Reading Binary Files
Writing Files
Seeking Within a File
Appending to Files
Catching File Exceptions
Wrapping Up
Review Questions
Chapter 16 - Importing
Using import
Using from to Import Specific Bits & Pieces
Using as to assign a new name
Importing Everything
Wrapping Up
Review Questions
Chapter 17 - Functions
Creating a Function
Calling a Function
Passing Arguments
Type Hinting Your Arguments
Passing Keyword Arguments
Required and Default Arguments
What are *args and **kwargs?
Positional-only Parameters
Scope
Wrapping Up
Review Questions
Chapter 18 - Classes
Class Creation
Figuring Out self
Public and Private Methods / Attributes
Subclass Creation
Polymorphism
Making the Class Nicer
Wrapping Up
Review Questions
Part II - Beyond the Basics
Chapter 19 - Introspection
Using the type() Function
Using the dir() Function
Getting help()
Other Built-in Introspection Tools
Wrapping Up
Review Questions
Chapter 20 - Installing Packages with pip
Installing a Package
Exploring Command Line Options
Installing with requirements.txt
Upgrading a Package
Checking What’s Installed
Uninstalling Packages
Alternatives to pip
Wrapping Up
Review Questions
Chapter 21 - Python Virtual Environments
Python’s venv Library
The virtualenv Package
Other Tools
Wrapping Up
Review Questions
Chapter 22 - Type Checking in Python
Pros and Cons of Type Hinting
Built-in Type Hinting / Variable Annotation
Collection Type Hinting
Hinting Values That Could be None
Type Hinting Functions
What To Do When Things Get Complicated
Classes
Decorators
Aliasing
Other Type Hints
Type Comments
Static Type Checking
Wrapping Up
Review Questions
Chapter 23 - Creating Multiple Threads
Pros of Using Threads
Cons of Using Threads
Creating Threads
Subclassing Thread
Writing Multiple Files with Threads
Wrapping Up
Review Questions
Chapter 24 - Creating Multiple Processes
Pros of Using Processes
Cons of Using Processes
Creating Processes with multiprocessing
Subclassing Process
Creating a Process Pool
Wrapping Up
Review Questions
Chapter 25 - Launching Subprocesses with Python
The subprocess.run() Function
The subprocess.Popen() Class
The subprocess.Popen.communicate() Function
Reading and Writing with stdin and stdout
Wrapping Up
Review Questions
Chapter 26 - Debugging Your Code with pdb
Starting pdb in the REPL
Starting pdb on the Command Line
Stepping Through Code
Adding Breakpoints in pdb
Creating a Breakpoint with set_trace()
Using the built-in breakpoint() Function
Getting Help
Wrapping Up
Review Questions
Chapter 27 - Learning About Decorators
Creating a Function
Creating a Decorator
Applying a Decorator with @
Creating a Decorator for Logging
Stacking Decorators
Passing Arguments to Decorators
Using a Class as a Decorator
Python’s Built-in Decorators
Python Properties
Wrapping Up
Review Questions
Chapter 28 - Assignment Expressions
Using Assignment Expressions
What You Cannot Do With Assignment Expressions
Wrapping Up
Review Questions
Chapter 29 - Profiling Your Code
Learning How to Profile with cProfile
Profiling a Python Script with cProfile
Working with Profile Data Using pstats
Other Profilers
Wrapping Up
Review Questions
Chapter 30 - An Introduction to Testing
Using doctest in the Terminal
Using doctest in Your Code
Using doctest From a Separate File
Using unittest For Test Driven Development
Wrapping Up
Review Questions
Chapter 31 - Learning About the Jupyter Notebook
Installing The Jupyter Notebook
Creating a Notebook
Adding Content
Adding an Extension
Exporting Notebooks to Other Formats
Wrapping Up
Review Questions
Part III - Practical Python
Chapter 32 - How to Create a Command-line Application with
argparse
Parsing Arguments
Creating Helpful Messages
Adding Aliases
Using Mutually Exclusive Arguments
Creating a Simple Search Utility
Wrapping Up
Review Questions
Chapter 33 - How to Parse XML
Parsing XML with ElementTree
Creating XML with ElementTree
Editing XML with ElementTree
Manipulating XML with lxml
Wrapping Up
Review Questions
Chapter 34 - How to Parse JSON
Encoding a JSON String
Saving JSON to Disk
Decoding a JSON String
Loading JSON from Disk
Validating JSON with json.tool
Wrapping Up
Review Questions
Chapter 35 - How to Scrape a Website
Rules for Web Scraping
Preparing to Scrape a Website
Scraping a Website
Downloading a File
Wrapping Up
Review Questions
Chapter 36 - How to Work with CSV files
Reading a CSV File
Reading a CSV File with DictReader
Writing a CSV File
Writing a CSV File with DictWriter
Wrapping Up
Review Questions
Chapter 37 - How to Work with a Database Using sqlite3
Creating a SQLite Database
Adding Data to Your Database
Searching Your Database
Editing Data in Your Database
Deleting Data From Your Database
Wrapping Up
Review Questions
Chapter 38 - Working with an Excel Document in Python
Python Excel Packages
Getting Sheets from a Workbook
Reading Cell Data
Iterating Over Rows and Columns
Writing Excel Spreadsheets
Adding and Removing Sheets
Adding and Deleting Rows and Columns
Wrapping Up
Review Questions
Chapter 39 - How to Generate a PDF
Installing ReportLab
Creating a Simple PDF with the Canvas
Creating Drawings and Adding Images Using the Canvas
Creating Multi-page Documents with PLATYPUS
Creating a Table
Wrapping Up
Review Questions
Chapter 40 - How to Create Graphs
Installing Matplotlib
Creating a Simple Line Chart with PyPlot
Creating a Bar Chart
Creating a Pie Chart
Adding Labels
Adding Titles to Plots
Creating a Legend
Showing Multiple Figures
Wrapping Up
Review Questions
Chapter 41 - How to Work with Images in Python
Installing Pillow
Opening Images
Cropping Images
Using Filters
Adding Borders
Resizing Images
Wrapping Up
Review Questions
Chapter 42 - How to Create a Graphical User Interface
Installing wxPython
Learning About Event Loops
How to Create Widgets
How to Lay Out Your Application
How to Add Events
How to Create an Application
Wrapping Up
Review Questions
Part IV - Distributing Your Code
Chapter 43 - How to Create a Python Package
Creating a Module
Creating a Package
Packaging a Project for PyPI
Creating Project Files
Creating setup.py
Generating a Python Wheel
Uploading to PyPI
Wrapping Up
Review Questions
Chapter 44 - How to Create an Exe for Windows
Installing PyInstaller
Creating an Executable for a Command-Line Application
Creating an Executable for a GUI
Wrapping Up
Review Questions
Chapter 45 - How to Create an Installer for Windows
Installing Inno Setup
Creating an Installer
Testing Your Installer
Wrapping Up
Review Questions
Chapter 46 - How to Create an “exe” for Mac
Installing PyInstaller
Creating an Executable with PyInstaller
Wrapping Up
Review Questions
Afterword
Appendix A - Version Control
Version Control Systems
Distributed vs Centralized Versioning
Common Terminology
Python IDE Version Control Support
Wrapping Up
Appendix B - Version Control with Git
Installing Git
Configuring Git
Creating a Project
Ignoring Files
Initializing a Repository
Checking the Project Status
Adding Files to a Repository
Committing Files
Viewing the Log
Changing a File
Reverting a File
Checking Out Previous Commits
Pushing to Github
Wrapping Up
Review Question Answer Key
Chapter 3 - Documenting Your Code
Chapter 4 - Working with Strings
Chapter 5 - Numeric Types
Chapter 6 - Learning About Lists
Chapter 7 - Learning About Tuples
Chapter 8 - Learning About Dictionaries
Chapter 9 - Learning About Sets
Chapter 10 - Boolean Operations and None
Chapter 11 - Conditional Statements
Chapter 12 - Learning About Loops
Chapter 13 - Python Comprehensions
Chapter 14 - Exception Handling
Chapter 15 - Working with Files
Chapter 16 - Importing
Chapter 17 - Functions
Chapter 18 - Classes
Chapter 19 - Introspection
Chapter 20 - Installing Packages with pip
Chapter 21 - Python Virtual Environments
Chapter 22 - Type Checking in Python
Chapter 23 - Creating Multiple Threads
Chapter 24 - Creating Multiple Processes
Chapter 25 - Launching Subprocesses with Python
Chapter 26 - Debugging Your Code
Chapter 27 - Learning About Decorators
Chapter 28 - Assignment Expressions
Chapter 29 - Profiling Your Code
Chapter 30 - An Introduction to Testing
Chapter 31 - Learning About the Jupyter Notebook
Chapter 32 - How to Create a Command Line Application with
argparse
Chapter 33 - How to Parse XML
Chapter 34 - How to Parse JSON
Chapter 35 - How to Scrape a Website
Chapter 36 - How to Work with CSV files
Chapter 37 - How to Work with a Database Using sqlite
Chapter 38 - Working with an Excel Document in Python
Chapter 39 - How to Generate a PDF
Chapter 40 - How to Create Graphs
Chapter 41 - How to Work with Images in Python
Chapter 42 - How to Create a Graphical User Interface
Chapter 43 - How to Create a Python Package
Chapter 44 - How to Create an Exe for Windows
Chapter 45 - How to Create an Installer for Windows
Chapter 46 - How to Create an “exe” for Mac
About the Technical Reviewers
Ethan Furman
Ethan, a largely self-taught programmer, discovered Python around the turn
of the century, but wasn’t able to explore it for nearly a decade. When he
finally did, he fell in love with it’s simple syntax, lack of boiler-plate, and
the ease with which one can express one’s ideas in code. After writing a dbf
library to aid in switching his company’s code over to Python, he authored
PEP 409, wrote the Enum implementation for PEP 435, and authored PEP
461. He was invited to be a core developer after PEP 435, which he happily
accepted.

He thanks his mother for his love of language, stories, and the written word.
Martin Breuss
With a background in education, Martin started to learn programming
mostly by himself through online resources after finishing university. Since
then, he’s worked as a curriculum developer, programming mentor, code
reviewer, and Python bootcamp instructor. Quality education, combined
with figuring out how to have fun while effectively learning unfamiliar
topics, has always been a big interest in his life. Currently, he creates
content for Real Python as well as online and in-person courses for
CodingNomads, a community for people learning to code.

If you are just starting out with computer programming, keep in mind that
learning something new takes time and effort, and that it will be easier if
you have fun while doing it. Some learning strategies that have been helpful
for Martin are (1) focusing on projects that interest him personally and (2)
actively participating in communities of motivated learners.
Acknowledgments
Writing is a time consuming process. For Python 101’s 2nd Edition, I
wanted to get some great technical reviewers so that the book would be
better than ever. I want to thank Martin Breuss for his many insightful
comments and useful suggestions. I was also honored to have Python core
developer Ethan Furman as a technical reviewer and editor. His time spent
ensuring correct code and improving content is appreciated.

I also want to thank the many people who have supported me through
Kickstarter and my blog. I have many amazing readers and friends, such as
Steve Barnes who gave me some great feedback on the first few chapters of
this book and Michal who helped with some of the chapters in part III.
There are so many of you who have helped me learn new things about
Python and been a wonderful community.

Thank you!

Mike
Introduction
Welcome to the 2nd Edition of Python 101! The original Python 101 came
out in the summer of 2014 and was written with Python 3.5 in mind. The
2nd Edition of this book has been completely updated and rearranged for
the latest version of Python, which at the time of writing is 3.8.

Some publishers / authors will only do minor updates when creating a new
edition of a book. That is not how I roll. I have personally gone through the
entire book and updated every single chapter. I have removed content that
was either no longer relevant or could lead to confusion to readers. I have
also added several new chapters to the book that cover such things as using
version control and setting up projects.

Many programming books will only teach you the basics of the language.
With Python 101, the goal is to help you not only learn the basics of the
language but to go beyond the basics and dig into some intermediate level
material. The reason for this is that you usually need to know more than the
basics to create something valuable.

Because of this, the book will be split up into the following four parts:

Part one will cover Python’s basics


Part two will be intermediate material
Part three will be a series of small tutorials
Part four will cover Python packaging and distribution

Note that not all sections will be the same length.

Let’s go ahead and talk about each of these sections in turn!


Part I - The Basics
This is the heart of the book. In this section you will learn all the basics that
you need to know to start using Python effectively. Each chapter will teach
you something new and they are ordered in such a way that they will build
on each other. If you already know Python well, then you can skip this
section and move on to Part II.
Part II - Intermediate Materials
Now that you know how Python works, you can dive into more
intermediate level material. In this section, you will learn about the
following topics:

Virtual environments
Type hinting
Threads and Processes
Debugging
Decorators
Code profiling
Basic testing

These topics cover some intermediate level Python and also help you learn
some key software development skills, like knowing how to debug your
code, add basic unit tests, and use version control.
Part III - Tutorials
This part of the book is where you will put it all together. You will learn
how to use Python with some real world scripts. These scripts will be basic,
but they will demonstrate the power of Python and what you can do with it.

Here is what will be covered:

How to Create a Command Line Application


How to Parse XML
How to Parse JSON
How to Scrape a Website
How to Work with CSV Files
How to Work with a SQLite Database
How to Create an Excel Document
How to Generate a PDF
Part IV - Python Packaging and Distribution
Now that you know how to write programs, you will probably want to
know how to share them with your friends. In this section, you will learn
how to transform your code into something that other developers or users
can use.

Specifically you will learn how to:

Create a Cross Platform Python Package


Create an Exe for Windows
Create an Installer for Windows
Create an “exe” for Mac

By the end of this section, you should be able to confidently distribute your
code all on your own!
Target Audience
This book is written for people that have used other programming
languages or taken some computer science or related classes. While this
book won’t handhold you through all the terminology, it will help you learn
how to use Python effectively. It also covers some intermediate level topics
that most beginner books do not.
About the Author
Michael Driscoll has been programming with Python for more than a
decade. He is active in multiple Python communities and is a contributor for
Real Python. Mike has also been blogging about Python at
http://www.blog.pythonlibrary.org/ for many years and has written several
books about Python:

Python 101 (1st Edition)


Python 201: Intermediate Python
wxPython Recipes
Python Interviews
ReportLab: PDF Publishing with Python
Jupyter Notebook 101
Creating GUI Applications with wxPython
Conventions
All technical books have their own conventions for how things are
presented. In this book, new topics will be in bold. When referring to
Python related keywords or code in a sentence, they will be in monospace.

Code blocks will look like this:


1 def greeter(name: str) -> None:
2 print(f'Hello {name}')
3
4 greeter('Mike')

There will also be blocks of code that represent Python’s interactive


interpreter, also known as a REPL:
1 >>> name = 'Mike'
2 >>> print(f'My name is {name}')
3 My name is Mike

This demonstrates how the interpreter should behave.


Requirements
You will need the Python language to follow along in this book. See chapter
1 for installation details or go get the official Python distribution for free at:

http://python.org/download/

If you need anything beyond what comes with Python, the chapter will tell
you how to install it.
Book Source Code
The book’s source code can be found on Github:

https://github.com/driscollis/python101code
Reader Feedback
If you enjoyed the book or have any other kind of feedback, I would love to
hear from you. You can contact me at the following:

[email protected]
Errata
I try my best not to publish errors in my writings, but it happens from time
to time. If you happen to see an error in this book, feel free to let me know
by emailing me at the following:

* [email protected]

Now let’s get started!


Part I - The Python Language
The first section of this book is dedicated to helping you learn the Python
programming language. You will learn all the basics that you need to know
to understand Python’s syntax. You may not know how to put it all together
when you finish this section, but that is the purpose of the following
sections.

In this part of the book, you will find:

Chapter 1 - Installing Python


Chapter 2 - Python Editors
Chapter 3 - Documenting Your Code
Chapter 4 - Working with Strings
Chapter 5 - Numeric Types
Chapter 6 - Learning About Lists
Chapter 7 - Learning About Tuples
Chapter 8 - Learning About Dictionaries
Chapter 9 - Learning About Sets
Chapter 10 - Boolean Operations and None
Chapter 11 - Conditional Statements
Chapter 12 - Learning About Loops
Chapter 13 - Python Comprehensions
Chapter 14 - Exception Handling
Chapter 15 - Working with Files
Chapter 16 - Importing
Chapter 17 - Functions
Chapter 18 - Classes

Once you have finished this section, you will be able to understand the
basics of Python and its syntax.

Let’s get started now!


Chapter 1 - Installing Python
Depending on which operating system you are using, you may need to
install the Python programming language. This chapter will cover the
primary ways to install Python.

First of all, there are several different versions of Python, which are called
“distributions”. A distribution is a word used to describe a collection of
software. A Python distribution will include the core Python language at a
minimum and sometimes include extra 3rd party libraries.

The official version is called Python or CPython and you can get it from the
following:

https://www.python.org/

Another popular distribution of Python is called Anaconda and comes from


the Anaconda company. This variation of Python is focused on data science
and includes many additional 3rd party packages in addition to Python’s
standard library. You can read more about it here:

https://www.anaconda.com/

Anaconda is designed to use a command-line tool called conda for


installing additional packages whereas Python uses pip, although you can
also use pip with Anaconda. Also note that the Anaconda download is
much larger than the official Python one is because it has so many extra
packages included with it.

If you are on a Windows PC and don’t have administrator privileges on


your machine, then you might want to check out WinPython, which can be
run from a USB:

https://winpython.github.io/
There are many other Python distributions to choose from. You can see a
bunch more here:

https://wiki.python.org/moin/PythonDistributions

This book is focused on Python 3. The current version at the time of writing
is Python 3.8. It is recommended that you use the official Python
distribution rather than Anaconda, although the examples in this book
should work for both. Any examples that use a specific feature only found
in 3.8 or newer will be noted as such.

There are 32-bit and 64-bit distributions of Python. If you are unsure what
your computer uses, you should opt for the 32-bit version if that is
available. Newer Macs no longer support 32-bit, so in that case you only
have one choice.
Installing on Windows
The https://www.python.org/ website has a download section where you can
download an installer for Python.

After the installer is downloaded, double-click it and go through the


installation wizard. Here is the first screen you should see:

Fig. 1-1: Installing Python 3.8 via the installer

There is a checkbox in the wizard for adding Python to the path. If you
don’t have an older version of Python already installed or if you want to use
the latest as your default Python, then I recommend that you check that
checkbox. It is unchecked by default, as shown in the image above.

If you install Python to your path, it will allow you to run Python from the
command line (cmd.exe) or Powershell by just typing python. If you install
Python using the Windows Store, it will automatically add Python to your
path.

The next page of the installation wizard allows you to enable or disable
optional features:
Fig. 1-2: Enabling Optional Python features

You can leave the defaults enabled, but if you are short on space, you
should untick the “Python Test Suite” option. The next page of the wizard
will allow you to enable Advanced Options:

Fig. 1-3: Advanced Options

Here you can install Python for all users of the machine. You can also
associate Python files with Python, create shortcuts, add Python to your
environment and more. Most of the time, the defaults will be fine. However
it’s a good idea to go ahead and check the “Precompile standard library” as
that can make Python run better on your machine.

When you press Next here, you will probably get a warning from Window’s
User Access Control:

Fig. 1-4: User Access Control Warning

This is a verification step that asks if you really want to proceed with
installing Python. Go ahead and press Yes. Now Python is being installed:

Fig. 1-5: Installing Python


Once the install finishes, you will see this final dialog:

Fig. 1-6: Setup Successful

You now have Python installed on your Windows machine! Try running
Python by opening cmd.exe:

Fig. 1-7: Running Python in cmd.exe

You should see something like the above. To exit, you can press CTRL+D
on Linux and Mac, CTRL+Z on Windows, or type exit() on any platform
and press Enter.
Installing on Mac
Macs usually come with Python pre-installed. However, if you want the
latest version of Python, then you may need to download Python.

The https://www.python.org/ website has a download section where you can


also download a Python installer for Mac. Once downloaded, you will need
to double-click it to install Python. You may need to tell your Mac to allow
you to install Python as the system might bring up a dialog box that warns
you about installing programs downloaded from the internet.

Note that the App Store does not have Python in it, so using the Python
website is the way to go.

Let’s take a moment to learn how to install Python on a Mac. Here’s the
first thing you will see when you double-click the downloaded pkg file:

Fig. 1-8: Installing Python on Mac OSX

This screen basically tells you what you are about to install and that you
will need to install some SSL certificates as well. Go ahead and press
Continue:
Fig. 1-9: Installing Python on Mac OSX (Read More)

This page gives you more information about the SSL certificate as well as
general information about using IDLE and Tkinter on a Mac. IDLE is
Python’s built-in code editor. You will learn more about that in the next
chapter. Tkinter is a Python library that you can use to create cross-platform
graphical user interfaces.

Tkinter is the library that is used to create IDLE, the Python editor that
comes with Python.

If you are interested, read through the information on this page. Otherwise,
go ahead and Continue:
Fig. 1-10: Installing Python on Mac OSX (License Agreement)

This is Python’s license agreement page. It also has a little bit of history
about Python on it. Feel free to check it out or skip it and press Continue:

Fig. 1-11: Installing Python on Mac OSX (Install Destination)


This page allows you to choose which disk on your computer you want to
install Python. I usually use the default, but if you want you can change it to
some other location.

Fig. 1-12: Installing Python on Mac OSX (Standard Install)

This page allows you to choose which folder to install Python to, in contrast
to the previous page which lets you pick which disk to install to.
Fig. 1-13: Installing Python on Mac OSX (Actual Installation)

This page shows the installation as it happens. You can wait and watch
Python get installed, or go get something to drink. Either way, Python will
be installed before too long.
Fig. 1-14: Installing Python on Mac OSX (Finished)

Here is the last page of the installation wizard.


Installing on Linux
Linux also usually comes with Python pre-installed, although it will likely
not be the latest version of Python. The Python website has source
downloads and directions that you can use to build the latest Python for
your Linux distribution.

The source download is Python source code with some build scripts
included that will allow you to build and install Python on Linux.

For full instructions, you should read the dev guide:

https://devguide.python.org/setup/

Sometimes you can also install a pre-built copy of the latest Python using
your package manager. One good source for Python on Linux is the
“deadsnakes” PPA. You will need to use Google to find it, but that makes it
much easier to install another version of Python on Linux.
Android / iOS
You can also run Python on Android and iOS via downloadable
applications. Pydroid is a popular application for Android while
Pythonista is one of the popular choices for iOS. Trying to write code on a
phone can be really problematic due to the on-screen keyboards. If you
must go this route, you may want to use a tablet.
Other Operating Systems
Python can run on Raspberry Pi as well. If you do not have a computer, this
is one of the most cost effective ways to get Python as a Raspberry Pi can
cost as little as $10. Of course, you will need to hook it up to a monitor,
keyboard and mouse. Most of the time, a Raspberry Pi will also need an SD
card for storage. But they are a very feasible development environment.
Other Python Variants
In addition to Anaconda, Python has several other variants that are worth
mentioning:

Jython - an implementation of Python written in Java that allows you


to use Java code in Python
IronPython - an implementation of Python written in .NET
PyPy - written in RPython, PyPy has a just-in-time (JIT) compiler that
makes it much faster than regular Python

The main reason for trying out these other implementations of Python is for
speed or flexibility. For example, if you are already familiar with .NET or
Java, then you might find IronPython or Jython a bit easier to jump into.
Another reason to use Jython or IronPython is because you have pre-
existing code in Java or .NET that you still need to use with Python.

In the case of PyPy, I usually recommend it if you have a slow Python


program and you need a simple way to speed it up. Try running it with
PyPy and you might be surprised at the performance improvement. Note
that none of these variants are completely compatible with all of Python’s
3rd party packages, so if your program uses one it may not work with these
variants.
Wrapping Up
Most of the time, installing Python is straight-forward and easy to do. It can
get tricky when you need to have multiple versions of Python installed on
your machine at the same time, but if you are just starting out I think you’ll
find the installation process pretty painless.

Now that you have Python installed, you can congratulate yourself. You
have started on a new endeavor and you have just taken the first step!
However, before you try running Python, you may want to read the next
chapter where you will learn about additional tools that will help you get
the most out of your Python adventure!
Exploring the Variety of Random
Documents with Different Content
"I am sad indeed, my dear," returned Mrs. Lesly, in the same absent
tone, "but I cannot find them, though they are all here." She
stopped and glanced at the secretary wistfully, as if its old-fashioned
drawers could speak if they liked.
"What is lost?" said Mabel, "let me try and find it—I will look over all
the papers if you will let me."
"No, no, what I have lost I ought to find, it is my own indolence
which has done it."
"Yes, but do not think of that now, mamma, love, remember Doctor
Parkinson said you were to be kept quite quiet, and now you are
wandering about all day—only think how precious your health is to
us, and how happy we all are when you are well."
"Mabel, you kill me by these words—I feel that I am dying, but do
not kill me before the time appointed."
Mabel was silent, and stood looking at her mother with painful
earnestness.
"Do not look at me so, sweet child. Well may you be surprised when
I have ruined you both."
"Ruin! my own mother, what do you mean?"
"Ah, you may well wonder at me," replied Mrs. Lesly, much excited,
"how could I be so silly as to injure my own children."
"Ah, now you are unkind," said Mabel, "why not tell me—is there a
sorrow I have refused to bear—is it not my privilege to be
sorrowful."
Tears rolled down her heated cheeks, and Mrs. Lesly continued to
regard her in silence.
"Is it not unjust to me, your own child," continued Mabel, (for she
had often before failed in obtaining her confidence,) "day after day
you are wearying yourself with something you will not let me know,
and injuring your health, which is more precious to us than any thing
else—mamma—I did not know you could be so unkind."
"Dear child, do not talk in this way, my only thought is of my
children, and oh!" said she, turning her head towards the secretary,
"if I could but find them."
"What?"
"The papers."
"What papers? Do tell me, can any thing be worse than this
concealment—you have always told me everything."
"Ah, if I had," said Mrs. Lesly, with a sigh.
"But do tell me now, I would rather hear any thing than see you
suffer."
"Can you really bear it?" enquired her mother, seeming to shake off
the oppressive calmness with which she had been speaking before,
and looking attentively at her daughter, whose warm feelings were
almost ready to burst control.
"I will bear any thing," answered Mabel, walking to her, and kneeling
by her side, "any thing you can tell me."
"Then you shall hear me now, lest you have cause to curse your
mother's memory, if you heard it when I was gone from you. Your
poor father put by a thousand pounds, which I never told you of
before. It would have been but a poor pittance—yet it would have
saved you from want; but this is nearly all gone now, for my sister
has been borrowing of me from time to time, promising to be a
mother to my children—I have lent her six hundred of the thousand,
and I have lost her promises to repay them back. Should any thing
happen to either of us, what will you do?"
"Trust to me, mother, dear. He who has supported me through far
worse trials will support me still."
"Reproach me now, Mabel," said Mrs. Lesly, sorrowfully, "but do not
live to curse me in the bitterness of your heart."
"No, my loved mother," said her daughter, looking up in her face
with unmistakeable cheerfulness, "think no more of this now. Amy
shall not suffer while health is left me, and power to use the
education my dear father gave me; and I am so happy to think
nothing worse is to be feared, even should any thing so strange
occur as that aunt Villars could not pay us. And do you think I could
once forget that it was because you were kind, unselfish and
generous, that you lent the money."
Mrs. Lesly lent down and folded her child in her arms, saying, in a
low repentant voice—
"Not generous but weak, we should but injure ourselves, not those
dependent on us in order to serve others."
Yet she felt as if a weight had passed from her heart, and though
she was still apprehensive, she was no longer despairing.
CHAPTER X.
How brief is the time since her voice was the
clearest,
Her laughter the loudest, amid the gay throng.
Hemans.

Could the selfish but remember how much less they would feel their
own sorrows by sharing those of others, they would learn an easy
way to alleviate the unhappiness they are continually guarding
against, by so occupying themselves in thoughts of pity and
kindness as to leave little room in their own minds for fear or regret.
The kindhearted very soon begin to feel an interest in those who are
thrown much with them, and, though Lucy presented many faults to
her notice, Mabel learnt to watch her with great interest. It soon
became evident to her that she was perfectly in earnest in her
attempts to engage the affections of Captain Clair, and, though at
first she had been disgusted and pained at the idea—more ready to
pity than condemn—she felt for Lucy when she perceived, by her
variable spirits, that her heart was engaged in the flirtation she had
so thoughtlessly commenced. The conduct of Clair puzzled her, she
wished to believe that his attentions were serious, and yet she could
not help thinking they meant nothing beyond the fashionable love he
might often have professed for the most pleasing young lady of any
society in which he happened to find himself. Still, she hoped she
was mistaken; and thought, over again and again the little
anecdotes which Lucy daily brought to her confidence, assuming
them as unmistakeable signs of an affection which would soon
declare itself.
Mabel knew that a look, a single word, even an emphasis on an
ordinary word are sometimes the evidences of affection. Yet, all that
Lucy told her, seemed to fall short, certainly of her ideas of love,
formed, as they had been, from her own unhappy history. Yet she
hesitated to speak her opinion freely; for, after all, it might be only a
very unkind suspicion of one who had not given any very good cause
for believing him to be a trifler. He had, besides, been so kind to
herself, that she could not help feeling prepossessed in his favor.
Meanwhile, Clair appeared as attentive as ever, but his attentions
were never varied by ill humour or depression. Still Lucy rested
confident in the power of her own attractions—and, persisting in
believing he was only diffident—she became more and more lavish
of encouragement, without, however, finding her admirer become
either warmer or bolder.
What was to be done? Her letters to Bath had been full of the
admiration she had inspired in the young officer, and of expectations
that, in a few more posts, she would have to announce his decided
proposals. The letters she received in return were full of delighted
badinage from her sisters, and good advice from her mother. How
then could she bear to return home with the tacit confession that
her vanity had deceived her; and thus subject herself to her sisters'
cutting jests, and the bitterness of her often disappointed mother.
The poor girl had been spoilt by education and companionship, and
she was, according to her own idea, forced to play desperately in
order to justify what she had written home. She did not stop to
consider that all delicacy, modesty, and all that is precious in a
woman, would be risked in such a game, when she read such words
as these in her mother's letters, "you might well pride yourself," she
wrote, "on being the first of my daughters whom I shall have the
pleasure of seeing married. Indeed I have always flattered myself,
that my Lucy would be the first to secure herself an establishment."
The seeds of vanity, thus sown by a mother's hand, grew quickly in
the daughter's heart. To be the first to be married was an idea that
filled her with pleasure; she did not stop to analyze, or she might
have discovered that the hope of mortifying her sisters by her
marriage, was inconsistent with the love she believed she felt for
them.
But now, what could she do! how could she bring her backward
lover to a proposal! She eagerly seized any opportunity of meeting
him, and never neglected pursuing any conversation which seemed
likely to lead to love. Still she was as far from her object as ever, and
at length she felt the feverish eagerness of a gambler to bring the
game to a successful close.
Mabel, who saw she suffered, sincerely, pitied her, though unable to
divine her thoughts. Disappointed affection the poor girl might have
successfully struggled against; but she could not banish the idea of
the sneers and jests, which, in contrast to her present popularity,
would meet her at home. Home, which in its sacred circle ought to
have afforded a refuge from every evil passion, as from every
outward danger. She knew it would not be so, and willingly would
she almost have thrown herself at the Captain's feet, and begged
him to protect her from it, rather than oblige her to return to such a
sanctuary.
Oh, fashionable and speculating mothers, why do you crush in your
children some of the sweetest and loveliest of their feelings. Why are
you so utterly foolish, as, first to make them unworthy of a
husband's trust and confidence, and then wonder that they do not
obtain them. A man seeks, in his wife, for a companion to his best
feelings, fit your daughters to fill such situations, and, should they
then fail to obtain them, they will still hold an honored place in
society.
Lucy felt that her success, in a matrimonial point of view, was all
that her mother regarded, that she seemed to view her daughters
with the eyes of the public, and valued them in proportion to the
admiration they excited, and she now strained every nerve to gratify
both her and herself.
There was one little plan to which she looked with great interest. Mr.
Ware's proposal of their taking tea in Mrs. Lesly's garden, was to be
carried into effect. They were all to dine early, and drink tea soon
enough to prevent any danger of taking cold, and Mabel was to
prepare them tea and fruit in the garden, while Miss Ware would
take hers quietly in doors with Mrs. Lesly. Amy talked herself tired
with planning it, for a week before, asking Mabel for an exact list of
all the fruit she meant to get for their entertainment. Lucy looked
forward to it more seriously; she fancied Clair entered so eagerly
into the plan that she hoped he had some particular reason for
wishing it, more than the mere pleasure of taking tea in the open air.
Was it not very likely, that lounging down one of the shady walks
which skirted the garden, he might find courage to tell all she so
much wished to hear.
The expected evening at length arrived.
Mrs. Lesly was unusually well, for the renewed confidence between
herself and her daughter had produced the most happy effects. Lucy
was all sparkling animation, and Clair forgot to be rational in the
effervescence of his good spirits. Lucy, whose fear of caterpillars was
quite touching, had persuaded Mabel to place the tea-table on the
open grass-plot—and there the sisters had delighted themselves in
arranging the simple repast. Amy was so accustomed to bustle along
by Mabel's side, that she had come to the belief that she could do
nothing well without her; and she now hurried about, laughing
merrily, as she conveyed to the table, plates of early fruit, which old
John had always carefully matted through the summer. Mr. Ware was
particularly fond of fruit, and it was a great pleasure to the sisters,
to store up every little luxury for him.
The table looked very pretty with its fruit, and cream, and flowers,
and the little party was a merry one, ready to take pleasure and
amusement in anything. Mr. Ware told stories of other days, and
Clair brought anecdotes of the fashionable world of his day, while
the girls were well-pleased listeners.
When tea had been fully discussed, they strolled round the garden,
watching for the sunset, which was to be the signal for taking
shelter in the house. Lucy, the captain, and Amy, went off laughing
together, while Mabel, choosing the driest path in the garden, paced
up and down by the side of Mr. Ware.
"It is very kind of you," he said, "to prefer my company to those who
are gayer and younger; but I am sorry to perceive that you are not
quite in your usual spirits—I hope you have no reason to be
depressed."
"None at all," replied Mabel, "and yet I am foolish enough to feel
low-spirited. But have you never felt a vague apprehension that
something dreadful was going to happen—I cannot overcome it to-
night."
"I have often felt the same from no reason, as you say, and have as
often found my fears groundless. Do you not remember those
beautiful words—'He feareth no evil tidings?'"
"Oh yes—I must not think of it again."
Mr. Ware thought this might be no bad opportunity of speaking of
Mrs. Lesly's delicate health, and leading her to prepare herself for a
trial which he foresaw was not far distant; but at the very moment
that he was thinking how to introduce the subject, the sound of
merry laughter came from the other side of the garden, and Mabel
exclaimed—
"Oh, I fear they are at the swing, and John says it's unsafe. I must
go and stop them."
And so saying, she ran quickly across the garden, till she reached
the spot where the swing was suspended from the branch of two tall
fir trees.
Amy was in the swing, which Captain Clair was pushing, while Lucy
was clapping her hands as each time the child rose higher in the air.
"Oh, do stop," said Mabel, running up to them quite out of breath,
and scarcely able to say any more.
"No, no," said Lucy, "we want to see if Amy can touch that bough.
What a beautiful swinger she is—she nearly did it then, I declare—
try again, Amy."
"John says it is unsafe," cried Mabel, trying to be heard, "do, do stop
—for mercy's sake, Captain Clair, do stop her."
Both were, however, deaf to her entreaty. Lucy rejoiced in what she
thought superior nerve, and called to her not to be an old maid,
frightened at everything; while Clair thought her very feminine and
pretty, but apprehended no real danger.
Mabel continued to exclaim, till unable to get a hearing, she burst
into tears of vexation and alarm, fearing to touch the rope, lest she
might cause the accident she feared.
At the same moment, while she watched Amy ascend quickly
through the air, till her feet scattered a few leaves from the bough
she had been trying to touch, there came a heaving sound, then a
loud crash—the swing gave way, and Amy fell violently to the
ground. With a scream of piercing anguish, she sprang to her side,
where she lay close by a knotted root of the tree, which she had
struck in falling.
Lucy stood blushing and terrified, uttering some confused excuses
for not listening to one who justice whispered was never fanciful.
Captain Clair looked bewildered and thoroughly ashamed, for often
the only excuse for daring is its success.
Mr. Ware fortunately soon reached the spot, and though extremely
vexed at such a termination to the day's enjoyment, merely roused
his nephew, by telling him to carry the poor child into the house,
and then to fetch a doctor, that they might be certain she had
sustained no serious injury.
His nephew, too happy to have some duty assigned, raised Amy in
his arms, for she was perfectly insensible, and, as Mabel supported
her drooping head, carried her into the house. Mabel's conduct
during that short walk cut him to the heart; she seemed entirely to
have forgotten that his obstinacy had injured her sister; and in her
anxiety for her safety, she did not suffer a complaining word to
escape her. Those who possess little control over their own feelings,
often reverence those who have great self-command—and to Clair,
who a few minutes before, had been laughing with almost childish
excitement, and was now utterly depressed, Mabel seemed like a
superior being in the calm dignity of her silent distress.
At length, Amy was safely placed upon her bed, and leaving Mabel
and their servant-maid to try every means to restore her to
consciousness, he hastened in search of a surgeon. He met Lucy in
the lane, who told him that she had anticipated his errand, but that
the doctor had gone to see a patient many miles away.
"Then I shall go for a horse, and follow him," said he, "anything will
be better than this suspense."
"And what shall I do?" cried Lucy, wringing her hands; but Clair had
no comfort to offer, and hurried on to the village to find a horse.
Lucy returned to the house, frightened, and ashamed. She did not
like to remain alone, yet there was no one in the sitting-room; and
not daring to seek any one, she retired to her own chamber, which
looked so still and lonely, that she put the door half open, and
seated herself in a chair close by, to listen for any news from Amy's
room. She could not help recalling to herself the wild laugh of the
poor child only half an hour before, and she could not bear to think
of how still she was lying there.
At length she heard Betsy, the privileged maid, say:—
"It is all Miss Lucy's fault, I know, for the house has not been the
same since she came into it."
"Hush, Betsy," was the murmured reply, in her cousin's well known
voice; "those thoughts will only make it harder to bear."
Betsy was not so easily stopped, but Mabel seemed to reply no
more.
Every word went to Lucy's heart. The frequent question of
despairing feeling. "What shall I do?" received no answer, and she
sat on in her desolate seat, or varied her watch by stealing on tiptoe
to the end of the passage. Thus the weary time slipt away, and she
had listened to the church clock, as it struck the hours till midnight—
she then heard the sound of horses' feet, and anxious for any
change, she ran down stairs—but she found that Clair and the
surgeon had already been admitted by Mr. Ware, who was watching
for them, and, feeling herself of no use, she again crept to her room
to listen, trembling for the doctor's opinion. The examination lasted
a long time, and she became nearly worn out with waiting, and
trying every minute to divine something from the hurried voices, or
hurried steps of the attendants in the sick room. But she could learn
nothing, till she heard the doctor leave the room, and lead Mabel to
that next her own, and then she heard her say in a tremulous voice.
"What do you think of her, Mr. Williams?"
"The accident has been a severe one," he returned.
"Can she recover?" was asked, in a tone which Lucy trembled to
hear, and she leant forward to catch the answer.
"A complete cure is beyond hope, my dear Miss Lesly; I entreat you
to bear up against this blow," were the words she caught; "my heart
bleeds for you, but I see the back is broken, and you know—" a
groan of anguish, which she would have fled miles to have escaped
hearing, was the only answer sentence thus given.
Then followed confused words, as if he were trying to comfort,
broken by suppressed sobs.
An agony of terror, alike for Amy and her sister, then seized her—she
trembled in every limb; and when she attempted to cry out, her
tongue seemed to refuse to utter a sound. She sank upon the floor,
too overpowered to move, and yet without the relief of fainting. Her
thoughts became more and more distinct—of Amy, growing,
perhaps, in beauty and womanhood, stretched on the bed of
helpless sickness, unable to find advantages in either. What a blight
had she cast upon a home she had found so happy. And Mabel, too,
the beautiful unselfish Mabel, no longer the playfellow of innocent
childhood, but the hopeless nurse of youthful decrepitude.
Too carelessly instructed as she had been, in the forms, and almost
wholly deficient in the spirit, of the religion she professed, she knew
of no balm that could heal a wound of such bitterness—she saw no
light that could have guided her to comfort. Highly as she prized
youth and its enjoyments, its hopes, and its ties, much as she
sparkled in company, and revelled in the admiration she excited, so
much did she feel the reverse to be dark and hard to bear. She
pictured Amy passing, in one five minutes, from her joyous
youthfulness, with its light laugh, and bounding glee, to the trials of
sickness which she might never more escape; probably, too, the
highly intellectual child becoming only the feeble-minded woman,
weakened by disease and suffering, and cut off from all those
endearing ties so prized by a woman's heart. As these thoughts
passed slowly, and impressively before her—she covered her face
with her hands, and wept long and bitterly.
CHAPTER XI.
Oh, how much more doth beauty beauteous
seem,
By that sweet ornament which truth doth
give.
The rose looks fair, but fairer we it deem,
For that sweet odour which doth in it live.
Shakspeare's Sonnet.

How awful is the feeling with which morning breaks in a house


where sudden grief and desolation has been wrought. Like Adam
and Eve in the garden, we shrink from each other, as if we feared to
read our own feelings in the faces of others, whose sufferings only
embitter our own.
The stillness of the past night broken by household sounds usually
so familiar as to attract no attention, recall the mind to the fact that
another day has opened on our life, showing more clearly the sorrow
of the night before.
Poor Amy! Mabel's love had thrown a kind of halo round the orphan
child, and those who did not love her for her own, loved her for
Mabel's sake.
Old John went heavily to his work, to move the benches and other
signs of the last evening's simple pleasure.
"Miss Mabel shall not see them again," he said to himself; "I cannot
give her much comfort—but I may spare her a little pain."
Mr. Ware and his sister had gone home, after affording all the
comfort and assistance in their power.
Mrs. Lesly had been persuaded to lie down, for, terrified and ill, she
needed repose, and Mabel, in grief, as in gladness, always took the
lead.
Lucy, exhausted and spiritless, too weary to get up, and too
irresolute to undress, had thrown herself upon her bed, and fallen
asleep.
When she again opened her eyes, the noon-day light was streaming
in upon her bed, and, to her great surprise, Mabel was standing by
her; she was pale as the dead, and her countenance gave evidence
of the agony of the last few hours—but there was a pale light in her
eyes, and a still repose about her, that seemed to hallow the grief
they concealed.
"I am glad you are awake," she said, in a voice scarcely above a
whisper—"I feared you might be ill—you slept so long."
Lucy's eyes were swollen with weeping and watching, and she
looked at her for a moment in despairing silence; at last she raised
herself, and seizing Mabel's hand, grasped it eagerly.
"Oh, Mabel, Mabel," said she, "what have I done—where can I hide
my face?"
And she sank again upon the bed, and buried her face in the pillow.
"You meant me no harm," replied her cousin—"at least, not much—
and I forgive you from my heart. My grief is too heavy for
resentment. But get up, Lucy, and do not distress me still more by
giving way in this manner."
"Oh, how I despise myself! to think that I am lying here while you
are waiting on me."
"Well, dear Lucy, get up now, for you will be better doing something,
and I cannot help pitying you here alone."
"Then tell me something I can do for you. Oh, I will do anything, but
I cannot get up to sit as I did last night."
"This is Saturday," replied Mabel, "and there are many things you
can do for me, which will enable me to be entirely with my poor
Amy. Shall I leave them to you?"
"Oh, yes," cried Lucy, jumping up, and throwing her arms round her;
"you are an angel—I cannot forgive myself—yet you forgive me
before I ask you."
Mabel kissed her silently, and gliding from the room, was soon again
by her sister's bed.
Amy was feverish, and perpetually wanted something to drink, but it
was touching to see how gently she asked for it, and how earnestly
she seemed to try to repress her own fretfulness, with her large blue
eyes fixed on her sister's face, as if trying to read her approval of
every checked complaint.
"It was very naughty of me," she whispered, "to get into the swing,
Mabel dear, when you told me not in the morning. Will you forgive
me?"
"You are in pain, love," said Mabel, tremulously; "and I cannot call
you naughty now."
"Then I am glad you have taught me not to want to be told—but I
shall not be happy till you just say you forgive me."
"My own darling, I forgive you a thousand times—would that I could
suffer instead of you."
"If I had not done wrong, I should not so much mind," said Amy,
thoughtfully; "but give me a little water, dear."
Mabel held the water to her lips, and Amy looked at her earnestly as
her hand trembled.
"Do not cry, Mabel dear," said she, in a feeble voice, "I shall very
soon be well again."
And weary with the pain she was bearing, without a murmur, she
closed her eyes.
Mabel's restrained tears fell fast, for well she knew that years to
come might find her the same helpless invalid as she now lay before
her.
The surgeon had given little hope, even in the first moment, when it
is seldom withheld; and she threw herself upon her knees, and
covered her face with her hands. Amy's fortitude and patience, while
it deeply moved her, made her thankful to find that her early lessons
had not been bestowed in vain.
Meanwhile Lucy roused herself with a stronger desire to be really
useful than she had felt for years. Mrs. Lesly had gone to sit with her
two children, so that she required nothing from her. She felt Mabel
could not more effectually have forgiven her than by allowing her to
assist in her duties, for it prevented her feeling the remorse of the
evening before. She ran down stairs with cups and waiters from the
sick room, which, if allowed to accumulate, give such real discomfort
to the sufferer, and even busied herself in helping Betsy in the
kitchen, spite of the sulkiness with which her services were
accepted.
But idle habits are not easily thrown aside with the distaste for
them; and, as the day wore on, she began to feel so fatigued that
she could not think how Mabel managed to do everything she did on
ordinary days—when, spite of her desire to please her, she felt her
strength fail in a few hours.
"But I have not been brought up like Mabel," she thought, too willing
to throw the blame on others, if by so doing she at all removed it
from herself. "How can she ever get through it," she said to herself,
eying disconsolately the large basket of clean linen, caps, and frills,
which Betsy had just laid down before her, saying that Miss Lesly
had said she would be kind enough to sort them.
She forced herself, however, to attempt it with many a sigh over its
difficulties. She had scarcely finished her task, when she saw Clair
coming up to the house, and, feeling a better conscience from her
exertions, for her spirits were easily elated, she went down stairs to
meet him.
When she entered the sitting-room, where, not venturing to knock
or ring, he had already seated himself, she found him with his head
buried in his hands, which rested on the table before him. He looked
up as she entered, and a momentary shudder passed over him,
which she could not help perceiving. His face was deadly pale, and
his features drawn together, and bearing the traces of deeper
thought than that in which he usually indulged. He had indeed done
many things more careless, and ten times as wrong, but the
consequences had never followed so rapidly nor been so heart-
rending.
"Oh, you have suffered," exclaimed Lucy, "and what a night I have
passed!"
"If you can see Miss Lesly," returned Clair, scarcely heeding her
observation, "ask her, in mercy, to see me for a few minutes."
His first thoughts are of Mabel, thought Lucy, with ready jealousy,
not one kind word for me.
"Will you?" said he, seeing her hesitate, "will you ask her to see me?
What does she say? How does she bear it? Does she reproach me?"
"What question shall I answer first?" said Lucy, with a little of her
returning levity.
Clair bit his lip, and looked at her with surprise, but Lucy quickly
recovering herself, said quietly,
"She bears it as we might have expected from her, she never spoke
of you—and forgave me before I dared ask for forgiveness, and she
would not suffer her servant to reproach me to her."
"Then there is some hope for me," he exclaimed, "but oh! how ten
times more killing is it to have injured one who will not return an
injury by an unkind word. Last night she looked at me with such pity
in her beautiful eyes, that I could have worshipped her. But do go."
Lucy burst into tears.
"What!" thought she, "was I earning for Mabel, when I was trying to
shew how much more nerve and spirit I possessed?"
Clair sat in silence, he did not spring to her side and take her hand,
soothing her, as only a lover knows how; and she left the room to
seek Mabel with feelings of indescribable remorse. Having delivered
her message to Betsy, she locked herself in her room, and once
more gave way to the most passionate grief.
Clair was left only a short while alone, before Mabel entered the
room. One glance at her pale cheek and sorrowful countenance, was
sufficient to tell, at once, how great the suffering had been, and how
it had been borne.
"Ah, Miss Lesly," he began, hurriedly, "can you ever look upon me
again without shuddering? I, who have been the cause of this
dreadful, desolating blow. Is it possible you can ever forgive me? but
I know you can; were I the vilest person on this earth you would
forgive me, if I asked it, but never will you look on me without
lamenting the horrid scene I shall always recall. Yet, I must hear
your forgiveness, and oh! if you could know what I have suffered, in
these few last wretched hours, you would pity me."
"I should not do you justice, Captain Clair," replied Mabel, trying to
speak steadily, "if I did not pity the pain you must feel in having
been the most unwilling cause of such an accident; but you must not
forget that it was unintentional: and I forgive you, from my heart,
for any share you may have had in this unhappy accident."
"They tell me," said he, shuddering, "that she never can be quite
well again. Oh!" cried he, throwing himself on his chair and groaning
heavily, "that I should have lived to be such a curse."
"You are but the instrument in a Hand mightier than your own,"
replied Mabel.
"Few punishments can be so great," replied Clair, bitterly, "as to be
chosen for the instrument of justice. It is only the worst soldier in
the army that is forced to inflict death on his condemned brother.
You will hate the instrument that has been raised to afflict you?"
"Should I not then be rebellious against the Hand that raised it?"
replied Mabel. "But, for my sake and your own, command your
feelings. I dare not think, yet, and you would force me to do so.
Why this has been suffered I must not ask now, for my faith may be
too small for argument, while grief has almost robbed me of my
senses. But I can see that you may have been made the unwilling
cause, possibly that you may think. Do not forget the merit of
suffering, for, if it chastens, it often purifies the heart; and do not let
poor Amy's health and hopes in life be offered up for nothing, for
there is a nobler self within you, which sorrow for our loss may call
forth—shake off all that sullies your character—all its littleness or
frivolity—and be yourself. Devote your life to some higher purpose,
and to nobler aims—go forth to the world again, a blessing to those
around you—and then," said she, sinking her voice as her eye lost its
brilliant fire, "and then Amy, on her sick bed, will feel that her loss
has been your advantage."
Clair almost held his breath while she spoke, and then exclaimed,
with a soldier's energy, as his eye seemed to have caught the fire
which had died in hers,
"I will, I will! You have doubly forgiven, for you have bestowed
thoughts which inspire me with hope. You," said he, as he
respectfully raised her hand to his lips, "you have more than
forgiven, and I bless you from my very soul."
Mabel gently withdrew her hand, and, excusing herself from staying
longer, left him to indulge the new reflections which her words had
awakened.
CHAPTER XII.
In the service of mankind to be
A guardian god below; still to employ
The mind's brave ardour in heroic arms,
Such as may raise us o'er the grovelling
herd
And make us shine for ever—that is life.
Thompson.

It was with increasing uneasiness, that Mabel perceived the effects


of their common grief on the weakened constitution of her mother.
Mrs. Lesly, at first, insisted on being constantly with her sick child,
but day by day her cheek became more pale, and her low hollow
cough more frequent, until she could scarcely reach Amy's room
without fatigue, and, instead of being able to nurse her, required,
herself, a further exertion of Mabel's ever watchful care. Grateful
indeed did the latter feel for the strong health, and stronger nerves,
which enabled her to maintain the watching and waiting required of
her—while the consciousness of being loved taught her that each
personal service rose in value because she rendered it. Lucy still
remained with them; she had insisted on her services being
received; and, though the idle girl was rather giving trouble than
making herself useful, Mabel did not refuse her offer to continue
with her, hoping that the wish to serve might be the seed of better
feelings and stronger self-denial.
But Lucy had not perhaps fully understood her motives, when she
ascribed her wish to stay to the desire to be of service.
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like