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

C and Python Applications: Embedding Python Code in C Programs, SQL Methods, and Python Sockets Philip Joyce download

The document provides an overview of the book 'C and Python Applications' by Philip Joyce, which teaches how to integrate Python with C programming, SQL methods, and socket programming. It covers basic concepts of both languages, SQL techniques, and includes exercises for practical understanding. The book is designed for readers with a basic familiarity with programming and mathematics, and supplementary materials are available on GitHub.

Uploaded by

zyfidabal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
6 views

C and Python Applications: Embedding Python Code in C Programs, SQL Methods, and Python Sockets Philip Joyce download

The document provides an overview of the book 'C and Python Applications' by Philip Joyce, which teaches how to integrate Python with C programming, SQL methods, and socket programming. It covers basic concepts of both languages, SQL techniques, and includes exercises for practical understanding. The book is designed for readers with a basic familiarity with programming and mathematics, and supplementary materials are available on GitHub.

Uploaded by

zyfidabal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 76

Visit https://ebookmass.

com to download the full version and


browse more ebooks or textbooks

C and Python Applications: Embedding Python Code


in C Programs, SQL Methods, and Python Sockets
Philip Joyce

_____ Press the link below to begin your download _____

https://ebookmass.com/product/c-and-python-applications-
embedding-python-code-in-c-programs-sql-methods-and-python-
sockets-philip-joyce/

Access ebookmass.com now to download high-quality


ebooks or textbooks
We have selected some products that you may be interested in
Click the link to download now or visit ebookmass.com
for more options!.

Python Programming and SQL: 10 Books in 1 - Supercharge


Your Career with Python Programming and SQL Andrew Reed

https://ebookmass.com/product/python-programming-and-sql-10-books-
in-1-supercharge-your-career-with-python-programming-and-sql-andrew-
reed/

Applied Numerical Methods with Python for Engineers and


Scientists Steven C. Chapra

https://ebookmass.com/product/applied-numerical-methods-with-python-
for-engineers-and-scientists-steven-c-chapra/

Top 10 Hacking Scripts in Python, C#, and ASP.NET: 2 Books


in 1: Unmasking Cyber Secrets: Python, C#, and ASP.NET
Scripts to Propel Your Hacking Journey Devwebtuts
Publishing
https://ebookmass.com/product/top-10-hacking-scripts-in-python-c-and-
asp-net-2-books-in-1-unmasking-cyber-secrets-python-c-and-asp-net-
scripts-to-propel-your-hacking-journey-devwebtuts-publishing/

Python Real-World Projects: Crafting your Python Portfolio


with Deployable Applications Steven F. Lott

https://ebookmass.com/product/python-real-world-projects-crafting-
your-python-portfolio-with-deployable-applications-steven-f-lott/
Fundamentals of Python: First Programs, 2nd Edition
Kenneth A. Lambert

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

Fortran with Python: Integrating legacy systems with


Python Bisette

https://ebookmass.com/product/fortran-with-python-integrating-legacy-
systems-with-python-bisette/

The Python Advantage: Python for excel in 2024 Hayden Van


Der Post

https://ebookmass.com/product/the-python-advantage-python-for-excel-
in-2024-hayden-van-der-post/

Coding for Kids 5 Books in 1: Javascript, Python and C++


Guide for Kids and Beginners Bob Mather

https://ebookmass.com/product/coding-for-kids-5-books-in-1-javascript-
python-and-c-guide-for-kids-and-beginners-bob-mather/

Data Mining for Business Analytics: Concepts, Techniques


and Applications in Python eBook

https://ebookmass.com/product/data-mining-for-business-analytics-
concepts-techniques-and-applications-in-python-ebook/
Philip Joyce

C and Python Applications


Embedding Python Code in C Programs,
SQL Methods, and Python Sockets
1st ed.
Philip Joyce
Crewe, UK

ISBN 978-1-4842-7773-7 e-ISBN 978-1-4842-7774-4


https://doi.org/10.1007/978-1-4842-7774-4

© Philip Joyce 2022

Apress Standard

The use of general descriptive names, registered names, trademarks,


service marks, etc. in this publication does not imply, even in the
absence of a specific statement, that such names are exempt from the
relevant protective laws and regulations and therefore free for general
use.

The publisher, the authors and the editors are safe to assume that the
advice and information in this book are believed to be true and accurate
at the date of publication. Neither the publisher nor the authors or the
editors give a warranty, expressed or implied, with respect to the
material contained herein or for any errors or omissions that may have
been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.

This Apress imprint is published by the registered company APress


Media, LLC part of Springer Nature.
The registered company address is: 1 New York Plaza, New York, NY
10004, U.S.A.
Introduction
The C and Python programming languages are important languages in
many computer applications. This book will demonstrate how to use
the C and Python languages to write applications in SQL. It will
demonstrate how to embed a Python program within a C program.
Finally, the reader will learn how to create Python socket programs
which can communicate with each other on different computers (these
are called “sockets”).
A basic familiarity with mathematics is assumed along with some
experience of the basics of computer programs. The first two chapters
review the basics of C and Python. The chapters following these are
grouped into SQL techniques, embedded Python, and sockets
applications. There are exercises in each chapter with answers and
suggested code at the end of the book.
Any source code or other supplementary material referenced by the
author in this book is available to readers on GitHub via the book’s
product page, located at www.apress.com/9781484277737. For more
detailed information, please visit http://www.apress.com/source-code.
Acknowledgments
Thanks to my wife, Anne, for her support, my son Michael, and my
daughter Katharine. All three have mathematics degrees. Thanks to
everyone on the Apress team who helped me with the publication of
this, my third book.
Table of Contents
Chapter 1:​Python Programming
Definition of Variables
Real (Float) Numbers
Characters
Reading in Data
Arrays
Inserting into an Array
Deleting (Removing) from an Array
Searching
Updating an Array
Appending to an Array
Strings
Lists
Reading Entries in a List
Updating a List
Deleting an Element from List
Appending to a List
Dictionaries
Creating a Dictionary
Appending to a Dictionary
Amending a Dictionary
Deleting from a Dictionary
Searching Through a Dictionary
Tuples
Creating a Tuple
Concatenating Two Tuples
Creating Nested Tuples
Creating Repeated Tuples
Converting a List or a String into a Tuple
Creating Single-Element Tuple
Reading Tuple
Searching Within a Tuple
Deleting a Tuple
Using Tuple to Create Variables
If Then Else
Loops (For and While)
For Loops
While Loops
Switches
Arithmetic Operations Using Numpy
Numpy Calculations
Mathematical Graph Functions
User-Written Functions
File Access
Regressions
Summary
Exercises
Chapter 2:​C Programming
C Program Format
Adding Two Numbers
Multiply and Divide Two Numbers
For Loops
Do While Loops
Switch Instruction
If Else
If Else If
Data Arrays
Functions
Strings
Structures
Size of Variables
Goto Command
Common Mathematical and Logical Symbols
File Access
Student Records File
Summary
Exercises
Chapter 3:​SQL in C
Review of SQL and SQLite
Creating the Database
Creating a Table
Inserting Rows
Insert a Preset Row
Inserting a User-Entered Row
Selecting Rows
Selecting a Row Preset
Selecting All Rows
Selecting Rows by Age
Amending Rows
Deleting Rows
Summary
Exercises
Chapter 4:​SQL in Python
Review of SQL
Create a Table
Mechanism for Inserting a Row
Update a Row
Delete a Row
Read a Table
Summary
Exercises
Chapter 5:​Embedded Python
Basic Mechanism
Plot a 2D Line
Plot Two 2D Lines
Plot Trigonometric Curves
Enter Data to Plot
2D Center of Mass Plot
Histograms
Importing a Picture
Summary
Exercise
Chapter 6:​Sockets
A Closer Look at Sockets
Basic Client-Server
Server-Client Pair to Send-Receive a File
Threaded Programs
Closing Down a Threaded Server
Chat Programs
Summary
Exercise
Appendix A:​Answers to Examples
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Index
About the Author
Philip Joyce
has 28 years of experience as a software engineer, working on control
of steel production, control of oil refineries, communications software
(pre-Internet), office products (server software), and computer control
of airports. He programs in Assembler, COBOL, Coral 66, C, and C++
with SQL. He served as a mentor to new graduates in the Ferranti
Company. He obtained an MSc in computational physics (including
augmented matrix techniques and Monte Carlo techniques using
Fortran) from Salford University in 1996. He is also a chartered
physicist and a member of the Institute of Physics (member of the
Higher Education Group).
About the Technical Reviewer
Swathi Sutrave
is a self-professed tech geek. She has
been a subject matter expert for several
different programming languages,
including Python, C, and SQL, for
corporations, startups, and universities.
© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
P. Joyce, C and Python Applications
https://doi.org/10.1007/978-1-4842-7774-4_1

1. Python Programming
Philip Joyce1
(1) Crewe, UK

This is the first of two chapters in which you’ll review both Python and C programming
languages. A basic understanding of computing and what programs are about is assumed
although no prior knowledge of either Python or C is needed.
In this chapter, we will start with the basics of Python. This will include how items used
in a program are stored in the computer, basic arithmetic formats, handling strings of
characters, reading in data that the user can enter on the command line, etc. Then we will
work up to file access on the computer, which will lead us up to industrial/commercial-level
computing by the end of the book.
If you don’t already have a Python development environment on your computer, you can
download it and the Development Kit, free of charge, from
www.python.org/downloads/. Another way you can access Python is by using Visual
Studio. Again, a version of this can be downloaded.

Definition of Variables
This section looks at the different types of store areas that are used in Python. We refer to
these store areas as “variables.” The different types can be numbers (integers or decimals),
characters, and different types of groups of these (strings, arrays, dictionaries, lists, or
tuples).
In these examples, you can go to the command line and enter “Python” which starts up
the Python environment and produces “>>>” as the prompt for you to enter Python code.
In Python, unlike C, you don’t define the variable as a specific type. The different types
are integer, floating point, character, string, etc. The type is assigned when you give the
variable a value. So try the following code:

>>> a1 = 51
>>> print(type(a1))
We get the output
<class 'int'>
>>>

Here we are defining a variable called “a1” and we are assigning the integer value 51 to
it.
We then call the function “print” with the parameter “type” and “a1” and we get the reply
“class ‘int’”. “type” means that we want to display whether the variable is an integer, floating
point, character, string, etc.
We can now exit the Python environment by typing “quit()”.
We will now perform the same function from a program.
Create a file called “typ1a.py”.
Then enter the following two lines of Python code:

a1=51
print(type(a1))

Now on the command line, enter “python typ1a.py”.


And you should get the output

<class 'int'>

which is the same as our first example.


This is just demonstrating the equivalence of the two methods.
Obviously, if you want to run a program with many lines of code and possibly run it many
times, then having the code in a file is more efficient.
We can demonstrate different data types being stored in the same variable using the
following code:

a1=51
print(type(a1))

a1=51.6
print(type(a1))

a1='51'
print(type(a1))

When we run this, we get

<class 'int'>
<class 'float'>
<class 'str'>

The 51 entered is an int. The 51.6 is a float (decimal) type, and ‘51’ is a string.
We can make the results a little clearer if we use print(“a1 is”, type(a1)).
So our program now reads

a1=51
print("a1 is",type(a1))

a1=51.6
print("a1 is",type(a1))

a1='51'
print("a1 is",type(a1))
and the output is

a1 is <class 'int'>
a1 is <class 'float'>
a1 is <class 'str'>

We can put a comment on our line of code by preceding it with the “#” character.

a1='51' #assign string containing 51 to variable a1


print("a1 is",type(a1)) # print the type assigned to a1

Some simple arithmetic operations are shown in the following.


The following code is held in the file “arith1.py”:

arith1a.py

Initialize the variables v1, v2, v3, and v4 with integer values.

v1= 2
v2 = 4
v3 = 7
v4 = 8

Add v1 to v2 and store the result in v5.

v5 = v1 + v2
print(v5)

The result is

You can combine the adding with the print as follows:

print(v1+v2)

Giving the same answer:

Now a subtraction:

v6 = v4 - v3
print(v6)
giving
1

Now a multiplication:
v7 = v4 * v3

print(v7)
giving
56
Now a division:

v8 = v4 / v1
print(v8)
giving
4.0

v10 = v3 % v2 # the % sign means show the remainder of the


division
print(v10)
gives
3

Raise by the power 2.

v11 = v2 ** 2
print(v11)
gives
16

Raise to the power held in variable v1.


Here v2 contains 4 and v1 contains 2.

v11 = v2 ** v1
print(v11)
gives
16

Show how Python obeys the rules of BODMAS (BIDMAS).


Here v2 contains 4, v1 contains 2, v3 contains 7, and v4 contains 8.

v11 = v1 + v2 * v4 - v3 # show BODMAS


print(v11)
gives
27

Show how Python obeys the normal algebra rules.

v11 = (v1 + v2) * (v4 - v3)


print(v11)
gives
6

Real (Float) Numbers


This type of number contains a decimal point. So, for the following assignments

V1 = 2
V2 = 3.5
V3 = 5.1
V4 = 6.75

we get

print(type(V1))
<class 'int'>
print(type(V2))
<class 'float'>
print(type(V3))
<class 'float'>
print(type(V4))
<class 'float'>

Characters
In Python, you can also assign characters to locations, for example:

c1 = 'a'
print(type(c1))
produces
<class 'str'>

which means that c1 is classed as a string.


Now that we know what different types of variables we can have, we will look at how we
use them.

Reading in Data
Now that we can display a message to the person running our program, we can ask them to
type in a character, then read the character, and print it to the screen. This section looks at
how the user can enter data to be read by the program.
If we type in the command

vara = input()

the computer waits for the user to type in data.


So if you now enter r5, the computer stores r5 in the variable vara.
You can check this by printing the contents of vara by typing

print(vara)

which prints

r5
We can make this more explicit by using

print("data typed in is:-", vara)


giving
data typed in is:-r5

You can also make the entry command clearer to the user by entering

varb=input(“enter some data to be stored in varb”)

Then, again we can explicitly print out the contents

print("data typed in is:-", varb)


giving
data typed in is:-r5

You have to use int(input) to enter an integer.


Otherwise, it is a string (one or more characters), for example:

n = int(input('Enter a number: '))


you enter 4
>>> print(type(n))
<class 'int'>

# Program to check input


# type in Python

num = input ("Enter number :")


print(num)
#You could enter 5 here and it would store 5 as a string and not
as a number
>>> print(num)
5
>>> print ("type of number", type(num))
type of number <class 'str'>
>>>

#entering a float number (type 'float' before the 'input'


command)
n = float(input('Enter a number: '))
Enter a number: 3.8
>>> print(type(n))
<class 'float'>
>>> print(n )
3.8

Now that we can enter data manually into the program, we will look at groups of data.
Arrays
An array is an area of store which contains a number of items. So from our previous section
on integers, we can have a number of integers defined together with the same label. Python
does not have a default type of array, although we have different types of array.
So we can have an array of integers called “firstintarr” with the numbers 2, 3, 5, 7, 11,
and 13 in it. Each of the entries is called an “element,” and the individual elements of the
array can be referenced using its position in the array. The position is called the “index.” The
elements in the array have to be of the same type. The type is shown at the beginning of the
array.
The array mechanism has to be imported into your program, as shown as follows:

from array import *


firstintarr = array('i', [2,3,5,7,11])

The ‘i’ in the definition of firstintarr means that the elements are integers.
And we can reference elements of the array using the index, for example:

v1 = firstintarr[3]
print(v1)

This outputs

We can also define floating point variables in an array by replacing the “i” by “f” in the
definition of the array.
So we can define

firstfloatarr = array( 'f', [0.2,4.3,21.9,7.7])

And we can now write

varfloat1 = firstfloatarr[1]
print(varfloat1)

This will store 4.3 into varfloat1.


The array mechanism has to be imported into your program.
So at the start of each program, you need to include the code

from array import *

Once we have our array, we can insert, delete, search, or update elements into the array.
Array is a container which can hold a fix number of items, and these items should be of
the same type. Most of the data structures make use of arrays to implement their
algorithms. The following are the important terms to understand the concept of array:
Insert
Delete (remove)
Search
Update
Append
Let’s review them now.

Inserting into an Array


The following code is in the file array3.py:

from array import *

myarr = array('i', [2,3,5,7,11])

myarr.insert(1,13) # this inserts 13 into position 1 of the array


(counting from 0)

for x in myarr:
print(x)

This outputs

2
13
3
5
7
11

Deleting (Removing) from an Array


The following code is in the source code file array4.py:
array4.py

from array import *

myarr = array('i', [2,3,5,7,11])

myarr.remove(2) # this removes the element containing 2 from the


array

for x in myarr:
print(x)

This outputs

3
5
7
11
Searching
The following code is in the file array5.py:

from array import *

myarr = array('i', [2,3,5,7,11])

print (myarr.index(3))#this finds the index of the array which


contains 3

This outputs

Updating an Array
The following code is in the file array6.py:
array6.py

from array import *

myarr = array('i', [2,3,5,7,11])

myarr[2] = 17) #this updates element 2 with 17

for x in myarr:
print(x)

This outputs

2
3
17
7
11

Appending to an Array
The following code is in the file array9a.py:
array9a.py

from array import *

myarr = array('i', [2,3,5,7,11])

for x in myarr:
print(x)

new = int(input("Enter an integer: "))


myarr.append(new)
print(myarr)
This outputs

2
3
5
7
11

Enter an integer: 19

array('i', [2, 3, 5, 7, 11, 19])

This section has shown the “array” use in Python.

Strings
Strings are similar to the character arrays we discussed in the previous section. They are
defined within quotation marks. These can be either single or double quotes. We can specify
parts of our defined string using the slice operator ([ ] and [:]). As with character arrays, we
can specify individual elements in the string using its position in the string (index) where
indexes start at 0.
We can concatenate two strings using “+” and repeat the string using “*”.
We cannot update elements of a string – they are immutable. This means that once they
are created, they cannot be amended.
The following code:

firststring = 'begin'
print(firststring)
gives
begin

The following code:

one = 1
two = 2
three = one + two
print(three)
#gives
3

The following code:

first = " first "


second= "second"
concat = first + " " + second
print(concat)
#gives
first second
print("concat: %s" % concat)
gives
concat: first second
The following code is in the file tst13a.py
secondstring = "second string"
print(secondstring.index("o")) #gives
3
print(secondstring.count("s")) # count the number of s characters
in string gives
2

print(secondstring[2:9]) # prints slice of string from 2 to 9


giving

cond st
print(secondstring[2:9:1]) # The general form is
[start:stop:step] giving

cond st
print(secondstring[::-1]) # Reverses the string giving

gnirts dnoces

splitup = secondstring.split(" ")


print(splitup) #gives
['second', 'string']
Strings are immutable, so if we tried

second= "second"
second[0]="q"

we get
Traceback (most recent call last):

File "<stdin>", line 1, in <module>

TypeError: 'str' object does not support item assignment


indicating that we tried to update something (a string in this case) which is immutable.

Lists
Lists are similar to arrays and strings, in that you define a number of elements, which can be
specified individually using the index. With lists, however, the elements can be of different
types, for example, a character, an integer, and a float.
The following code is in the file alist7.py:

firstlist = ['k', 97 ,56.42, 64.08, 'bernard']


We specify the elements within square brackets.
We can then access individual elements in the list using the index (starting from 0), for
example:

print(firstlist[0])
gives
k
print(firstlist[1:3])
gives
[97, 56.42]

We can amend an element in a list.

firstlist[3] = 'plj'
print(firstlist)
giving
['k', 97, 56.42, 'plj', 'bernard']

We can delete an element from a list.

del firstlist[3]
print(firstlist)
giving
['k', 97, 56.42, 'bernard']

We can append an element to the list.

firstlist.append(453.769)
print(firstlist)
giving
['k', 97, 56.42, 'bernard', 453.769]

Reading Entries in a List


The following code is held in the file alist1a.py:
alist1a.py

list1 = ['first', 'second', 'third']


list2 = [1, 2, 3, 4, 5 ]

print ("list1: ", list1)


print ("list1[0]: ", list1[0])
print ("list2: ", list2)
print ("list2[3]: ", list2[3])
print ("list2[:3]: ", list2[:3])
print ("list2[2:]: ", list2[2:])
print ("list2[1:3]: ", list2[1:3])

This outputs
list1: ['first', 'second', 'third']
list1[0]: first
list2: [1, 2, 3, 4, 5]
list2[3]: 4
list2[:3]: [1, 2, 3]
list2[2:]: [3, 4, 5]
list2[1:3]: [2, 3]

Updating a List
The following code is held in the file alist2a.py:

alist2a.py

list1 = [1, 2, 3, 4, 5 ]

print ("list1: ", list1)

list1[1] = 26 #update the second item (counting from zero)

print ("updated list1: ", list1)

This outputs

list1: [1, 2, 3, 4, 5]
updated list1: [1, 26, 3, 4, 5]

Deleting an Element from List


The following code is held in the file alist3a.py:

alist3a.py
list1 = [1,2,3,4,5,6]
print (list1)
del list1[4]
print ("Updated list1 : ", list1)

This outputs

[1, 2, 3, 4, 5, 6]
Updated list1 : [1, 2, 3, 4, 6]

Appending to a List
The following code is held in the file alist4aa.py:

alist4aa.py
list2 = [10,11,12,13,14,15]
print (list2)
new = int(input("Enter an integer: "))
list2.append(new)
print(list2)
This outputs (if you enter 489)

[10, 11, 12, 13, 14, 15]

Enter an integer: 489

[10, 11, 12, 13, 14, 15, 489]

This has shown the use of lists.

Dictionaries
Dictionaries contain a list of items where one item acts as a key to the next. The list is
unordered and can be amended. The key-value relationships are unique. Dictionaries are
mutable.

Creating a Dictionary
In the first example, we create an empty dictionary. In the second, we have entries.

firstdict = {}

or

firstdict ={'1':'first','two':'second','my3':'3rd'}

Appending to a Dictionary
The following code is held in the file adict1a.py:

adict1a.py
#create the dictionary
adict1 = {'1':'first','two':'second','my3':'3rd'}

print (adict1)

print (adict1['two']) # in the dictionary 'two' is the key to


'second'

adict1[4] = 'four' # we want to add another value called 'four'


whose key is 4

print (adict1)

print (len(adict1)) #this will print the number of key-value


pairs

This outputs
{'1': 'first', 'two': 'second', 'my3': '3rd'}
second
{'1': 'first', 'two': 'second', 'my3': '3rd', 4: 'four'}
4
If we want to add value whose key is dinsdale, then we specify it as ‘dinsdale’.
So

adict1['dinsdale'] = 'doug'
print (adict1)

outputs

{'1': 'first', 'two': 'second', 'my3': '3rd', 4: 'four',


'dinsdale': 'doug'}

Amending a Dictionary
The following code is held in the file adict2a.py.
This amends the value whose key is ‘two’ to be '2nd'.

adict2a.py
adict1 = {'1':'first','two':'second','my3':'3rd'}

adict1['two'] = '2nd'

print(adict1)

This outputs

{'1': 'first', 'two': '2nd', 'my3': '3rd'}

Deleting from a Dictionary


The following code is held in the file adict3a.py:

adict3a.py
adict1 = {'1':'first','two':'second','my3':'3rd'}
print(adict1)
del adict1['two'] #this deletes the key-value pair whose key is
'two'
print(adict1)

This outputs

{'1': 'first', 'two': 'second', 'my3': '3rd'}


{'1': 'first', 'my3': '3rd'}

Searching Through a Dictionary


We want to search a dictionary to see if a specific key is contained in it. In this case, we want
to see if ‘a’ and ‘c’ are keys in the dictionary.
In Python

>>> my_dict = {'a' : 'one', 'b' : 'two'}

>>> 'a' in my_dict


TRUE
>>> 'c' in my_dict
FALSE

The following code is held in the file adict5aa.py:

adict5aa.py
print("Enter key to be tested: ")
testkey = input()
my_dict = {'a' : 'one', 'b' : 'two'}
print (my_dict.get(testkey, "none"))

This outputs (if you enter “a” when asked for a key)
Enter key to be tested:
a
one
or outputs (if you enter “x” when asked for a key)
Enter key to be tested:
x
none
We have seen what dictionaries can do. We now look at tuples.

Tuples
A tuple contains items which are immutable. The elements of a tuple can be separated by
commas within brackets or individual quoted elements separated by commas. They are
accessed in a similar way to arrays, whereby the elements are numbered from 0. In this
section, we will look at creating, concatenating, reading, deleting, and searching through
tuples.
For example, define two tuples called firsttup and secondttup:

firsttup = ('a', 'b', 'c', 1, 2, 3)


secondtup = “a”, “b”, 10, 25

The following code refers to the third element of firsttup:

firsttup[2]
gives
c

The following code refers to the third element of firsttup:

firsttup[3]
gives
1
secondtup = "a", "b", 10, 25
The following code refers to the second element of secondtup:

secondtup[1]
gives
b

The following code refers to the third element of secondtup:

secondtup[2]
gives
10

We can also use negative indices to select from the end and work backward, for example,

secondtup[-1]

which gives

25
secondtup[-2]

which gives

10

Tuples cannot be amended.


So if we had

firsttup = ('a', 'b' 'c', 1, 2, 3)


firsttup[3] = 9

we would get

File "<stdin>", line 1, in <module>

TypeError: 'tuple' object does not support item assignment

Creating a Tuple
# An empty tuple
empty_tuple = ()
print (empty_tuple)
()

# Creating non-empty tuples


# One way of creation
tup = 'first', 'second'
print(tup)
('first', 'second')

# Another for doing the same


tup = ('first', 'second')
print(tup)
('first', 'second')

Concatenating Two Tuples


# Code for concatenating 2 tuples

tuple1 = (0, 1, 2, 3)
tuple2 = ('first', 'second')

# Concatenating above two


print(tuple1 + tuple2)
(0, 1, 2, 3, 'first', 'second')

Creating Nested Tuples


# Code for creating nested tuples

tuple1 = (0, 1, 2, 3)
tuple2 = ('first', 'second')
tuple3 = (tuple1, tuple2)
print(tuple3)
gives
((0, 1, 2, 3), ('first', 'second'))

Creating Repeated Tuples


# Code to create a tuple with repetition

tuple3 = ('first',)*3
print(tuple3)
gives
('first', 'first', 'first')

Converting a List or a String into a Tuple


# Code for converting a list and a string into a tuple

list1 = [0, 1, 2]
print(tuple(list1))
(0, 1, 2)
print(tuple('first')) # string 'first'
('f', 'i', 'r', 's', 't')

Creating Single-Element Tuple


# Creating tuple with single element (note that we still require
the comma)
t=(1,)
print(t)
gives
(1,)

Reading Tuple
# Reading from start (index starts at zero)
tup1=(2,3,4,5,6,7)
tup[3]
gives
5

# Reading from end (index starts at -1)


tup1[-1]
gives
7

Searching Within a Tuple


# Search
tup1=(2,3,4,5,6,7)
print (6 in tup1) # this tests if 6 is contained in tup1
gives
True
print (9 in tup1)
gives
False

Deleting a Tuple
# Deleting a complete Tuple
del tup1
print(tup1)
gives

NameError: name 'tup1' is not defined

Using Tuple to Create Variables


# define our tuple as
aTuple = (10, 20, 30, 40)
# Now we can assign each of its elements to separate variables
a, b, c, d = aTuple
print(a)
gives
10
print(b)
gives
20
print(c)
gives
30
print(d)
gives
40

We have covered definitions and uses of different types of variables in this section. We
will now look at the use of “if” statements.

If Then Else
When a decision has to be made in your program to either do one operation or the other, we
use if statements.
These are fairly straightforward. Basically, we say

if (something is true)
Perform a task

This is the basic form of if.


We can extend this to say

if (a condition is true)
Perform a task
else if it does not satisfy the above condition
Perform a different task

Here is some Python code to demonstrate this:

number = 5
if number > 3:
print('greater than 3')

number = 5
if number > 3:
print('greater than 3')
else:
print('not greater than 3')
Type in this code into a program and run it. It should come as no surprise that the output
is

greater than 3

You could modify the program so that you input the number to be tested, but don’t forget
that for this code you need number = int(input (“Enter number :”)) to enter a number.
This section has shown the importance of “if” statements in programming. Now we will
look at loops.

Loops (For and While)


When we were doing many calculations in a program, it could be a bit of a chore to do a
similar thing with, say, ten numbers. We could have done it by repeating similar code ten
times. We can make this a bit simpler by writing one piece of code but then looping round
the same piece of code ten times. This is called a “for loop.” We will also look at “while”
loops.

For Loops
Here is an example of how a for loop can help us.
The statement is

'for x in variable
Carry out some code'

So if we have a variable as the following


forloopvar1 = [20, 13, 56, 9]
we can say

for x in forloopvar1: # go through forloop1 and place each


element in x
print(x) #this is the only instruction within the loop

outputs

20
13
56
9

The “range” instruction in Python has the general format


range(start, stop, step)
where
“start” is the start value of the index. Default is 0.
“stop” is 1 less than the last index to be used.
“step” is by how much the index is incremented. Default is 1.
Here is an example using the “range” instruction.
The program goes round the for loop starting with variables number and total set to 1.
Within the loop, it multiplies the current value of the number by the running total. Then
it adds 1 to the number. So it is working out 1*2*3*4*5*6*7*8*9*10 or “10 factorial” (10!).

number = 1
total = 1
for x in range(10): ): #so here start is 0 (default), stop is 10-
1, and step is 1
total = total * number
number = number + 1
print(total)

This outputs

3628800

which you can check with your scientific calculator is 10 factorial.

for x in range(3, 6): # starts with 3 and ends with 6-1


print(x)

This outputs

3
4
5

We can also have a list of values instead of a range, as shown in the next program.
This goes through the values and finds the index position of the value 46. We can see that
46 is in position 9 (counting from 0) .

forloopvar1 = [20, 13, 56, 9, 32, 19, 87, 51, 70, 46, 56]
count = 0
for x in forloopvar1:
if x == 46:
break
count = count + 1
print(count)

This outputs

While Loops
The logic of “while” loops is similar to our for loops .
Here, we say

'while x is true
Carry out some code'
So we could have the following code which keeps adding 1 to count until count is no
longer less than 10. Within the loop, the user is asked to enter integers. These are added to a
total which is printed out at the end of the loop.

total = 0;
number = 0
# while loop goes round 10 times
while number < 10 :

# ask the user to enter the integer number


n = int(input('Enter a number: '))

total = total + n
number = number + 1
print('Total Sum is = ', total)

So if the user enters the number shown in the following, we get the total:

Enter a number: 1
Enter a number: 2
Enter a number: 3
Enter a number: 4
Enter a number: 5
Enter a number: 6
Enter a number: 7
Enter a number: 8
Enter a number: 9
Enter a number: 10
Total Sum is = 55

We have seen the importance of loops in this section. Our next section looks at switches.

Switches
In C programming, there is an instruction used widely called “switch.” However, because
there is no switch statement in Python, this section will demonstrate some code that can be
included into your programs to perform the same function.
A switch jumps to a piece of code depending on the value of the variable it receives. For
instance, if you had to perform different code for people in their 30s to that for people in
their 40s and different to people in their 50s, we could have the following code. Here we
have the value in “option” which determines which code we jump to.
The code for this function is in the file aswitch3.py:

aswitch3.py
def switch(option):
if option == 30:
print("Code for people in their 30s")
elif option == 40:
print("Code for people in their 40s")

elif option == 50:

print("Code for people in their 50s")

else:
print("Incorrect option")
#main code in the program where you enter 30,40 or 50 and the
function 'switch' is called which uses the appropriate number as
shown.
optionentered = int(input("enter your option (30, 40 or 50 : )
"))
switch(optionentered)
running this program and entering '50' gives
enter your option : 50
Code for people in their 50s
This section has shown how to perform a switch in Python. We now move onto an
important library of functions in Python. This is called “numpy.”

Arithmetic Operations Using Numpy


Numpy is a library of mathematical functions that can be included into your Python
program. It is useful in manipulating arrays, reading text files, and working with
mathematical formulas. Numpy can be installed in various ways. One way is using “pip” from
the command line as shown as follows:

pip install numpy

It is particularly useful in manipulating matrices (or arrays with extra dimensions). The
arrays we have looked at so far are one-dimensional arrays. In this section, we will look at
arrays with more dimensions. A one-dimensional array can also be called a “rank 1 array.”

onedarray = array('i', [10,20,30,40,50])

We import numpy into our program using “import numpy”, and we assign a link for our
program. Here we define the link as “np” so the full line of code is

import numpy as np

The numpy function “shape” returns the dimensions of the array. So if your array was
defined as

b = np.array([[1,2,3],[4,5,6]])

then the array would be a 2x3 matrix (two rows and three columns) as shown as follows:

[[1 2 3]
[4 5 6]]
So if you now type

print(b.shape)

you would get

(2, 3)

as the shape.
The code for this function is in the file numpy1.py:

import numpy as np

a = np.array([1, 2, 3]) # Create a rank 1 array


print(type(a)) # Prints "<class 'numpy.ndarray'>"
print(a.shape) # Prints "(3,)"
print(a[0], a[1], a[2]) # Prints "1 2 3"
a[0] = 5 # Change an element of the array
print(a) # Prints "[5, 2, 3]"

b = np.array([[1,2,3],[4,5,6]]) # Create a rank 2 array

#1 2 3
#4 5 6
# reference elements counting from 0
# so b[1, 2] is row 1 (2nd row) column 2 (3rd column)
#so if you print b[1, 2] you get 6
print("b[1, 2] follows")
print(b[1, 2])

print(b.shape) # Prints "(2, 3)" 2 rows 3


columns
print(b[0, 0], b[0, 1], b[0, 2]) # Prints "1 2 3"
print(b[1, 0], b[1, 1], b[1, 2]) # Prints "4 5 6"
print(b[0, 0], b[0, 1], b[1, 0]) # Prints "1 2 4"

The normal mathematical representation of a matrix is as shown as follows:

This is what we have defined in the preceding code using the following line of code:

b = np.array([[1,2,3],[4,5,6]]) # Create a rank 2 array

Matrix arithmetic can be understood by looking at real-life examples. The following are
tables of three people working for a computer company. The first table shows how many
laptops and how many printers each person sells in a month.
In Store Sale

Person Laptops Printers


Joe 4 5
Mary 6 7
Jen 7 9

The next table shows how many laptops and printers each person has sold online.
Online Sale

Person Laptops Printers


Joe 6 22
Mary 21 24
Jen 41 17

These tables can be represented by matrices as shown in the following. We add each
term in the first matrix to the corresponding term in the second matrix to give the totals
shown in the third matrix.

The next table shows the total of laptops and printers sold by each person:
Total/Overall Sale

Person Laptops Printers


Joe 10 27
Mary 27 31
Jen 48 26

If each person doubles their total sales the following month, we can just multiply their
current sales total by 2 as shown as follows:

We now look at their totals for the first month and have another table containing the cost of
a laptop and the cost of a printer.
Total Sales
Person Laptops Printers Cost/Item list with
cost
Joe 10 27 Laptop 200
Mary 27 31 Printer 25
Jen 48 26
We can work out how much money each person makes for the company my multiplying
their total number of sales of a laptop by its cost. Then we multiply their total number of
sales of printers by its cost and then add these two together. The table and the
corresponding matrix representations of this are shown as follows:

Sales Cost
Joe 10x200 + 27x25 = 2975
Mary 27x200 + 31x25 = 3875
Jen 48x200 + 26x25 = 4775

There is a rule when multiplying matrices. The number of columns in the first matrix has
to be equal to the number of rows of the second matrix.
So if we say that a matrix is 2x3 (two rows and three columns), then it can multiply a 3x2
or a 3x3 or a 3.4, etc. matrix. It cannot multiply a 2x3 or 2x4 or 4x2 or 4x3, etc.

In the multiplication in the preceding diagram, we see it is (3x2) x (2x1) producing a (3x1)
matrix.

Numpy Calculations
Listings 1-1 through 1-5 are some programs to show basic numpy calculations with
matrices.
Add two 2x2 matrices.

import numpy as np

a = np.array(([3,1],[6,4]))

b = np.array(([1,8],[4,2]))

c = a + b
print('matrix a is')
print(a)
print('matrix b is')
print(b)
print('matrix c is')
print(c)
Listing 1-1 numpmat.py
This outputs

matrix a is
[[3 1]
[6 4]]
matrix b is
[[1 8]
[4 2]]
matrix c is
[[ 4 9]
[10 6]]

Add a 2x3 matrix to another 2x3 matrix.

import numpy as np

a = np.array(([1,2,3],[4,5,6]))

b = np.array(([3,2,1],[6,5,4]))

d = a + b

c = 2*a

print('matrix a is')
print(a)
print('matrix b is')
print(b)
print('matrix d is')
print(d)
print('matrix c is')
print(c)
Listing 1-2 numpmat2.py

This outputs

matrix a is
[[1 2 3]
[4 5 6]]
matrix b is
[[3 2 1]
[6 5 4]]
matrix d is
[[ 4 4 4]
[10 10 10]]
matrix c is
[[ 2 4 6]
[ 8 10 12]]
Add a 2x2 matrix to a 2x2 matrix both floating point.

import numpy as np

a = np.array(([3.1,1.2],[6.3,4.5]))

b = np.array(([1.3,8.6],[4.9,2.8]))

c = a + b

print('matrix a is')
print(a)
print('matrix b is')
print(b)
print('matrix c is')
print(c)
Listing 1-3 numpmat3.py

This outputs

matrix a is
[[3.1 1.2]
[6.3 4.5]]
matrix b is
[[1.3 8.6]
[4.9 2.8]]
matrix c is
[[ 4.4 9.8]
[11.2 7.3]]

Multiply a 3x2 matrix by a 2x1 matrix.

import numpy as np

a = np.array(([1,2],[4,5],[6,8]))

b = np.array(([3],[6]))

c = np.matmul(a,b) #matmul is the numpy function for multiplying


matrices

print('matrix a is')
print(a)
print('matrix b is')
print(b)
print('matrix c is')
print(c)
Listing 1-4 numpmat4.py
This outputs

matrix a is
[[1 2]
[4 5]
[6 8]]
matrix b is
[[3]
[6]]
matrix c is
[[15]
[42]
[66]]

Multiply a 3x2 matrix by a 2x3 matrix.


If you did this manually with pen and paper, this is how you would do it:

Note the way you do the multiplication by hand, 1st row x 1st column, 1st row x 2nd
column, 1st row x 3rd column, then 2nd row, and then 3rd row. Of course, if you use
numpy’s matmul function, it is all done for you.

import numpy as np

a = np.array(([1,2],[3,4],[5,6]))

b = np.array(([7,8,9],[10,11,12]))

c = np.matmul(a,b)

print('matrix a is')
print(a)
print('matrix b is')
print(b)
print('matrix c is')
print(c)
Listing 1-5 numpmat5.py
This outputs

matrix a is
[[1 2]
[3 4]
[5 6]]
matrix b is
[[ 7 8 9]
[10 11 12]]
matrix c is
[[ 27 30 33]
[ 61 68 75]
[ 95 106 117]]

This section has explored the important numpy mathematical functions in Python.

Mathematical Graph Functions


In a similar way that we included the numpy library into our programs, we can include
graph plotting libraries called “matplotlib.pyplot” so we can access the graph functions
library with the code

import matplotlib.pyplot as plt

In our program, this makes plt our pointer to matplotlib.pyplot.


You can install matplotlib using the “pip” instruction

pip install matplotlib

The program here is going to plot a graph of the marks that people got in an
examination.
The code for this function is in the file mp1a.py:

mp1a.py
import matplotlib.pyplot as plt
# x values:
marks = list(range(0, 100, 10)) #marks (x values) divided into
equal values up to 100
print(marks) # write the values calculated by the previous
instruction

This produces
[0, 10, 20, 30, 40, 50, 60, 70, 80, 90]
# y values:
people = [4, 7, 9, 17, 22, 25, 28, 18, 6, 2]
# label the axes
plt.xlabel('marks')
plt.ylabel('people')
plt.plot(marks, people)
plt.show()
and outputs

[0, 10, 20, 30, 40, 50, 60, 70, 80, 90]

These plot the graph shown in Figure 1-1.

Figure 1-1 Example of plotting (x,y) points

We see from the graph that most people got marks between about 30 and 70, which is
what you would expect. A few got low marks and only a few got high marks.
The next program, mp2aa.py, plots two graphs on the same axes. Here we plot
examination marks gained by females and those gained by males. We plot females as one
color and males as another.
The code for this function is in the file mp2aa.py:
Other documents randomly have
different content
CHAPTER CXXX.
PERDITA.

A week had elapsed since the arrival of Mrs. and Miss Fitzhardinge in
the great metropolis; and as yet they appeared to be no nearer to
an acquaintanceship with Charles Hatfield than they were on the day
when they first beheld him issue from Lord Ellingham’s mansion;—
for that it was he whom they had seen on the occasion alluded to,
the mother had satisfactorily ascertained.

Indeed, the old woman had not been idle. Every evening, for a
couple of hours, did she watch in the immediate vicinity of the Earl’s
dwelling to obtain an interview with the young man: but he did not
appear to go out after dusk.

Mrs. Fitzhardinge accordingly began to think of changing her tactics,


and endeavouring to catch him in the day-time, when fortune at last
favoured her views;—for on the eighth night of her loiterings in Pall
Mall, she had the satisfaction of seeing him sally forth shortly after
nine o’clock.

Unhesitatingly accosting him, she said, “Mr. Hatfield, will you accord
me your attention for a few moments?”

The young man turned towards her, and beheld a very ugly, plainly-
attired, old lady: he nevertheless answered her respectfully, because
she had addressed him in a manner denoting genteel breeding. We
should observe, too, that she had purposely assumed a humble
apparel on the occasion of these evening watchings, in order to
avoid the chance of attracting the attention of passers-by or
policemen, who would naturally have wondered to see a handsomely
apparelled person thus loitering about.

“Certainly, madam,” replied Charles: “I will listen to any thing you


may have to say to me. Will you walk into the house which I have
just left: ’tis the mansion of the Earl of Ellingham.”

“I know well who lives there, Mr. Hatfield,” answered the old woman;
“and it is precisely because I wish to speak to you alone, that I have
accosted you in the street. Can you pardon such boldness?”

“If your business with me be of importance, madam,” said Charles,


“no apology can be necessary on your part.”

“Yes—my business is indeed of importance,” returned Mrs.


Fitzhardinge, with mysterious emphasis. “But I cannot speak to you
here——”

“I have already requested you to accompany me to the house where


I am residing with my relatives and friends,” said Charles, with the
least indication of impatience in his manner.

“And I have already assured you that I am anxious to converse with


you alone,” responded the old woman, nothing daunted. “Do not
mistrust me, sir—do not suppose that I have accosted you for the
purpose of soliciting any assistance of a pecuniary kind——”

“Then, madam, what do you require of me?” asked Charles, hastily.

“Ten minutes’ private conversation—on matters of importance—of


deep importance to yourself!” replied Mrs. Fitzhardinge, as rapidly
and as firmly as the other had spoken: then, before he had time to
make any rejoinder, she added, “For your own sake, Mr. Hatfield—if
for no other consideration—you will accompany me to my own
dwelling, which is close at hand. What! you hesitate? Then continue
to cherish the secret grief which weighs upon your mind——”

“Ah! what did you say?” ejaculated the young man, starting as if a
chord had been touched so as to vibrate to his very heart’s core.

“I mean that if you refuse to accompany me, you will repent the loss
of an opportunity to receive revelations nearly concerning yourself,
and which opportunity may not speedily occur again.”

As Mrs. Fitzhardinge uttered these words, she fixed a strange,


mysterious, and almost ominous look upon Charles Hatfield, who
was bewildered and amazed by her language. The old woman had
dealt her random shots with good effect; and she experienced an
inward triumph at her skill, and a sure conviction of its success.

“Who are you? and what do you know of me?” demanded Charles,
breaking silence abruptly after more than a minute’s pause, and
speaking in a tone of earnestness denoting mingled suspense,
wonder, and curiosity.

“My name is Fitzhardinge,” replied the old woman; “and I know all—
every thing concerning you,—aye, much more than you can possibly
suspect. But not another word of explanation will I utter here; and
you may now decide whether you will at once accompany me——”

“I will accompany you, madam,” interrupted Charles Hatfield, in a


decided manner. “In which direction does your abode lie?”

“Five minutes will take us thither,” was the answer.

The old woman and the young gentleman now proceeded in silence
towards Suffolk Street, Pall Mall—the latter wondering who his
companion might be, what she could possibly have to communicate
to him, and how she had acquired the information which she alleged
to be so important and was about to impart. He naturally associated
the promised revelations with the mysterious circumstances which
he had so recently fathomed by means of the letters and
manuscripts found in the secret recess of the library at Lord
Ellingham’s mansion;—and yet he was at a loss to conceive how a
Mrs. Fitzhardinge, whose name was entirely strange to him, could
possibly have any connexion with his own family affairs. At one
moment he fancied that the proceeding on her part was nothing
more nor less than a plot to inveigle him to some den for predatory
purposes: for he had heard that London abounded in such horrible
places, and also in persons who adopted every kind of stratagem to
lure the unwary into those fatal snares. But when he considered the
quarter of the great metropolis in which his companion evidently
resided, as she had assured him that her abode was only a few
minutes’ walk from the spot where she had first accosted him,—
when he again noticed the respectability of her appearance, and
reflected that there was something superior in her manners,
language, and address,—and lastly, when he remembered that
amidst circumstances so complicated and mysterious as those which
regarded his own family, it was highly possible for that aged female
to be interested in them in some way or another,—he blamed
himself for his misgivings, and resolved to see the end of the
adventure.

Scarcely was his mind thus made up, when Mrs. Fitzhardinge turned
into Suffolk Street; and in less than another minute, she knocked in
an authoritative manner at the door of a handsome house. The
summons was instantaneously responded to by a respectable
female-servant; and Charles Hatfield followed the old lady up a wide
stair-case lighted by a lamp which a statue in a niche held in its
hand. On reaching the first landing, Mrs. Fitzhardinge threw open a
door, saying, “Walk into this room, Mr. Hatfield: I will join you in a
few moments.”

Charles entered—and the door immediately closed behind him.

The young man found himself in a well-furnished apartment, in


which the light of the wax candles placed upon the mantel was
reflected in a handsome mirror. The atmosphere was rendered
perfumed and refreshing by vases of fresh flowers tastefully
disposed around: and on a side-table stood a large globe filled with
the clearest water, in which gold and silver fish were disporting. The
curtains were closed over the windows; but still the room was cool
and the air grateful in that sultry summer season.

These observations were made at a rapid glance;—and then Charles


Hatfield’s looks were concentrated in the cynosure which instantly
absorbed all interest—all attention. For, half sitting, half reclining
upon the sofa, was a being of such transcendant beauty that never
in the wildest of his dreams had he conceived the like. When reading
a novel or a poem, his imagination had often depicted to itself the
semblance of the heroine—and this mental portraiture was invariably
drawn with the utmost perfection of form and feature which
impassioned and enthusiastic youth could devise. But no flight—no
soaring of that fervid imagination had ever yet idealised such
dazzling, brilliant charms as those which now met his astonished
gaze,—charms that intoxicated while they delighted, and that
ravished while they infused a warm voluptuousness into the soul of
the beholder.

And, in sooth, well might Charles Hatfield experience ineffable


feelings and tender emotions as he contemplated the fiend in an
angel’s shape that was half reclining on the sofa; for Perdita was
surpassingly lovely on this occasion! She was attired in a light pink
muslin dress, made very low in the body, so that her neck and
shoulders were set off in all their dazzling whiteness against the
deep purple velvet of the sofa—and her full, swelling, firm bosom
was more than half revealed. Her hair was arranged in long ringlets,
glittering like hyperions, luxuriant, and sweeping those glowing
globes that appeared to heave to their caresses. Her large grey eyes
beamed with voluptuous languor, although a brilliant light shone in
the depths of the dark pupils;—and her vermilion lips, parted with a
smile, displayed the white and even rows of pearls, so faultless in
their beauty. The slightly sun-burnt tinge of her face appeared to be
the rich hue of an Italian complexion—the carnation glow of health,
and youth, and warm blood animating her cheeks. Then her arms
were naked,—those arms which were dazzlingly white, robust, and
yet admirably modelled, and which seemed ready to stretch out and
clasp a favoured lover to the panting breast. One foot was raised on
the sofa—the other rested on an ottoman;—and thus, as Charles
Hatfield’s eyes swept the rich and fine proportions—the undulating
contours of that splendid form, it seemed to him as if a halo of
voluptuousness surrounded this enchanting being—a very perfume
of beauty enveloped her in its intoxicating influence.

She had heard him ascending the stairs—and she had purposely
placed herself in an attitude which should seem as if he had
disturbed her unexpectedly, and thus serve as an apology for the
negligent abandonment of limb which gave to her position an air
alike wanton and lascivious. While she, therefore, affected to gaze
on him in soft surprise, he was intently devouring her with looks of
unfeigned amazement;—and while she still retained that voluptuous
attitude as if unwittingly, he was rivetted to the spot near the door
where he had stopped short on first catching sight of her. This
dumb-show on the part of both,—artificial with her, and real with
him,—lasted for nearly a minute;—and during that time Perdita had
an opportunity of surveying the young man’s handsome appearance
with even more searching scrutiny than when she had seen him in
Pall Mall the very day of her arrival in London,—while, on his side,
Charles Hatfield had leisure to scan a combination of charms such as
transcended all his ideal creations, and which, had he beheld them
in a picture, he would have declared to be impossible of realization.

Again must we observe how different was this elegantly-attired,


captivating creature as she now appeared, from the ragged, way-
worn wanderer that she was when first we introduced her to our
readers! But oh! dangerous—trebly dangerous Perdita,—a snake
with the loveliest skin—a demon with the most heavenly form—utter
profligacy in the most witching guise!
And now the young man, who has been brought within the sphere of
this perilous influence, recovers his self-possession so far as to be
able to stammer forth an apology for what he conceives to be an
intrusion occasioned by some strange mistake.

“No excuse is necessary, sir,” replies Perdita; “The lady whom you
state to have conducted you hither, is my mother; and she has
doubtless sought her chamber for a few minutes to change her
attire. Pray be seated.”

But Charles Hatfield once more stood still—rivetted to the spot, after
having advanced a few paces towards Perdita;—for the sound of her
voice, so sweetly musical—so enchantingly harmonious, appeared to
inspire him with ecstatic emotions and infuse an ineffable delight
into his very soul.

Then Perdita arose from the sofa, and indicating a chair close by,
again invited the young man to be seated,—accomplishing this
courtesy with so ravishing a grace and such a charming smile, that
he felt himself intoxicated—bewildered—enchanted by the magic of
her beauty, the melody of her silver tones, and the soft persuasion
of her manner. For the consciousness of almost superhuman beauty
had rendered Perdita emulative of every art and taught her to study
every movement which might invest her with a winning way and a
witching power;—and thus this singular young woman had acquired
a politeness so complete that it seemed intuitive, and a polish so
refined that it appeared to have been gained by long and unvaried
association with the highest classes.

Sinking into the chair thus gracefully offered him, Charles Hatfield
could not take his eyes off the magnificent creature who remained
standing for a few seconds after he was seated; for, affecting to alter
the position of one of the wax candles on the mantel, as if it were
too near the mirror, she placed herself in such an attitude that the
young man might obtain a perfect view of the flowing outlines of her
glorious form,—the splendid arching of the swan-like neck—the
luxurious fulness of the bust—the tapering slenderness of the waist
—the plump and rounded arms—the large, projecting hips—and the
finely proportioned feet and ankles.

The effect thus produced by the artful, designing creature, whose


voluptuous position seemed all natural and all unstudied, was
precisely that which she had intended;—for Charles Hatfield
experienced a delirium of emotions till then unknown—and he felt
that he could almost spring from his seat, catch that bewitching
form in his arms, and, covering her with kisses, exclaim, “Pardon me
—but I am mad—intoxicated—raving with passion!”

“My mother will not be many minutes, sir,” said Perdita, now
returning to her seat upon the sofa; “and in the meantime I must
solicit you to exercise your patience—for I am afraid you will find me
but a dull companion.”

“Impossible!” cried Charles, enthusiastically; then fearing that he


had spoken in too decided and earnest a manner to one who was a
perfect stranger, he added in a more subdued and reserved tone,
“But perhaps I am intruding on your privacy, as I am afraid that
when I entered—I mean, I fear that I—I disturbed you——”

“I certainly was not aware that my mother expected a visitor this


evening,” answered Perdita; “and it is I who should apologise,
inasmuch as you caught me in such a lounging, lazy attitude. But
since I have been in London I have experienced a heaviness in the
atmosphere that engenders indolence—for I have hitherto been
accustomed to the country.”

“Then you have not long resided in London, Miss Fitzhardinge?” said
Charles, hazarding this mode of address with the determination of
ascertaining whether the beautiful young woman were married or
single.

“We have only been in this city for one week,” she replied in an
acquiescent way which convinced him that she had not changed the
parental name by means of wedlock—a discovery that infused a
secret glow of pleasure into his very soul, though at the same
instant his heart smote him as if he were already playing a
treacherous part in respect to Lady Frances Ellingham. “No,”
continued Perdita, “we have not long resided in London. Urgent
affairs have compelled my mother to visit the capital; and as our
stay is likely to be of considerable duration, we are about to take a
house. For my part, I am not sorry that we are thus to settle in
London: for, in spite of its oppressive atmosphere, its smoke, and its
noise, it has many attractions.”

“You have already seen enough, then, to induce you to prefer


London to the country, Miss Fitzhardinge?” said Charles, now
admiring the fine aquiline profile of which he was suffered to obtain
a perfect view, as Perdita half averted her looks on purpose, though
quite in a natural manner.

“I have seen enough to render me an enthusiastic admirer of your


great city,” she replied, now turning her full countenance upon him,
and smiling so as to display her brilliant teeth: “but I am anxious to
behold more, and my wish cannot very readily be gratified. For, save
our attorney, we have no acquaintances—no friends in London: we
are perfect strangers here—and we cannot very well ask our solicitor
to escort us to the theatre and to those places of amusement which
ladies would hardly choose to visit unless accompanied and
protected by a gentleman.”

“Is it possible that you, Miss Fitzhardinge, should have to experience


the want of such a chaperon?” demanded Charles Hatfield, again
hurried by his enthusiasm into language too little reserved and
distant for a perfect stranger to address to a young lady:—at least,
so he thought and feared immediately after he had made the
observation.

“It is very possible,” replied Perdita, in a mild and almost plaintive


tone. “In the country we had numerous friends; but here——”
And the artful creature, stopping short, stooped down to pick up her
handkerchief as if to apply it to her eyes:—at the same instant
Charles, obeying the impulse of polite attention, bent down also to
save the lady the trouble and perform the little act of courtesy, when
their hair—their very cheeks came in contact,—accidentally as the
confused and bewildered Charles imagined, but intentionally on the
part of the wanton and astute Perdita.

And that contact—Oh! it was thrilling in the extreme; and Charles


Hatfield felt as if his veins ran with liquid fire;—for the perfume
exhaled from the lady’s hair—the velvety feeling of the luxuriant
curls—the softness and the warmth of her carnation cheek—and
then the view which he could not possibly avoid for a moment
obtaining of the glowing breast which her stooping posture
completely revealed,—all this was sufficient to madden him with
passion and excite him to a degree when all self-command becomes
nearly impossible. But he still possessed a sufficiency of mental
energy to controul himself; and, stammering forth an awkward
apology, he hurriedly observed, “Would you not think me too bold,
Miss Fitzhardinge, I should be proud to offer my services as a
chaperon to yourself—and your mother,” he added for decency’s
sake.

The instant this offer was made,—made without the least


forethought and in the confusion of the young man’s mind arising
from the incidents just related,—he repented of his rashness: he
would have given worlds to be able to recall the proposal. For, in a
moment to his mind flashed the image of the lovely Lady Frances
Ellingham—the reflection that he was offering his attentions to a
young person totally unknown to him—the remembrance that he
had many matters of importance to occupy his leisure—and the
general impression that he had committed himself in a most
singularly foolish and inconsiderate manner.

Perdita saw what was passing in his mind: at least, she perceived
that he repented of the proposal which he had so precipitately
made, and which it had rejoiced her so much to receive;—and she
resolved to conquer his scruples—overcome his repugnance—and
confirm him in the act of vassalage to which her transcendent
charms and her wanton arts had already prompted him.

Laying her soft warm hand upon his, and approaching her
countenance so near to his own that her fragrant breath fanned his
cheek, she said, in a tone apparently of deep emotion, “Mr. Hatfield,
this proposal is so generous—so kind—so unexpected, that I know
not how to answer you otherwise than by expressing my sincere
gratitude. And yet—so frankly have you made the offer, that it would
be a miserable affectation on my part to hesitate or to appear leas
candid and open in accepting it. I do therefore accept it, my dear sir
—and with renewed thanks. And think not that in constituting
yourself the friend—for in such a light must I henceforth consider
you—of Miss Fitzhardinge, you are doing aught derogatory to
yourself. No: for my mother is descended from an old and illustrious
family,—a family which has enumerated amongst its members
personages of rank, eminence, and renown;—and should the
Chancery suit which she has come to London to prosecute, result
favourably to her, she will recover an enormous fortune that has
been accumulating for years through remaining in a dormant state.”

While Perdita was delivering this tissue of falsehoods with an air of


the most profound sincerity, she still kept her hand upon that of the
young man—still retained her countenance near his own—and
likewise fixed upon him looks at once languishing, tender, and
voluptuous.

Again did he lose all power of sober reflection and, completely


yielding to the influence which the syren had in so short a time
gained over him, he said, “I shall be proud and delighted to act as
your escort, Miss Fitzhardinge. But you just now addressed me by
my name—and yet I thought you were unprepared for my presence
here this evening.”
“I was well aware that my mother wished to see you on particular
business,” said Perdita, having a ready reply for every question that
might be put to her; “and therefore when I saw you enter the room,
I concluded that you must be Mr. Charles Hatfield.”

“And are you acquainted with the nature of the business concerning
which Mrs. Fitzhardinge desired to speak with me?” inquired the
young man, wondering why the old lady did not make her
appearance.

“Yes—I am well informed on that subject,” returned Perdita; “but


pray do not ask me to talk to you on business! I detest the very
name! And now perhaps you will consider me a silly—flighty—volatile
creature——”

“I consider you to be an angel of beauty!” exclaimed Charles, unable


to restrain the raptures which hurried him on to this impassioned
ejaculation.

“I was told before I came to London that the gentlemen of the great
metropolis were very fond of paying silly young ladies vain and
empty compliments,” said Perdita, looking with good-humoured
archness at her companion, while her eyes beamed with wickedness
and her bosom heaved visibly.

“Is it the first time that you have been assured of your beauty?”
asked Charles, still carried away by an uncontroullable influence.

“No—not precisely the first,” responded Perdita, with a naiveté so


admirably assumed that her companion believed it to be completely
genuine. “There was a young gentleman—or rather a nobleman, but
I must not mention his name—in the country, who offered me his
hand;—and he paid me many very fine compliments.”

“And you accepted the proposal? you are engaged to him?”


exclaimed Charles, with a strange fluttering of the heart.
“Neither the one nor the other,” answered Perdita. “I could not love
him—and therefore I declined the honour. My mother was angry with
me, and talked a great deal about the excellence of the match and
so forth: but I was obstinate—yes, very obstinate, Mr. Hatfield,” she
said archly; “for never—never,” she continued, her tone suddenly
becoming earnest and her manner serious,—“never could I bestow
my hand where I cannot likewise give my heart!”

“And you have resolved wisely, Miss Fitzhardinge!” exclaimed


Charles. “Matrimony without sincere affection can afford no promise
of happiness. But one so beautiful as yourself—impressed too with
such sterling sentiments and harbouring such pure principles—oh,
you will prove indeed a treasure to the man who is fortunate enough
to secure your heart and hand!”

“Again you compliment me, Mr. Hatfield,” said Perdita, looking down
and blushing,—for even her very blushes she could command at
pleasure. “In reference, however, to the observation you have just
made, I should remark that I have never yet met with one of your
sex whom I could comprehend fully and who could understand me. I
admire openness, candour and sincerity,—that generous frankness,
too, which at once establishes friendship and dissipates cold
formality. For I believe that the trammels of ceremonial politeness
positively spoil the heart,—tutoring it to curb its enthusiasm where
enthusiasm would be so natural! I know not how to express myself
clearly; but what I mean to imply is this—that I am a believer in the
possibility of friendship at first sight——”

“And of love at first sight also?” exclaimed Charles Hatfleld, in an


impassioned tone.

“Yes—and of love at first sight also,” repeated Perdita, again hanging


down her head—again commanding a deep blush—and likewise
speaking in a low, melting tone of deep emotion, as she drew a long
sigh.
“Was it that possibility of experiencing the feeling of friendship at
first sight, which led you to accept my proposed services as an
escort to the places of public amusement?” enquired Charles.

“Wherefore do you seek thus to probe the secret feelings of my


soul?” asked Perdita, turning upon him a look indicative of mingled
pleasure and amazement.

“Have I offended you by the question, charming lady?” exclaimed


Charles.

“Oh! I do not so readily take offence, Mr. Hatfield,” cried Perdita.


“But—frank, candid, and ingenuous though I believe myself to be—I
still have my little feelings of pride, and I could not think of making
an avowal to a gentleman otherwise than as a reciprocity.”

“Then were I to declare sincerely and solemnly—and on my honour


as a man—that it was a sentiment of friendship, experienced at first
sight and according to your own doctrine, which prompted me to
offer my services as a chaperon,” said Charles, hastily and
enthusiastically, “would you deign to answer my question?”

“Such a declaration on your part, sir, would necessarily elicit—nay,


demand some kind of a response on mine,” returned the artful
beauty, looking down, and tapping the carpet with her foot in such a
manner that her ankle peeped from beneath her dress, and the
young man’s eyes could catch a glimpse of the exquisitely white skin
through the net work of the dainty silk stocking.

Charles hesitated: an avowal of friendship trembled on his tongue—


but he thought how dangerous such a confession would be—he
thought, too, of Lady Frances Ellingham!

And Perdita again perceived that he hesitated; and instantly had


recourse to a new artifice to display her charms to their utmost
advantage. Stooping down, she affected to arrange the ottoman in
the most convenient manner for her feet;—but, in this attitude which
seemed so natural, ingenuous, and artless, she revealed so much of
the treasures of her bosom that no room was left for imaginings—
and Charles Hatfield felt himself seized with a delirium in which he
would have made over his soul to Satan had such been the price
demanded for the possession of Perdita.

“Miss Fitzhardinge,” he said, his voice almost subdued and his


tongue parched through the maddening fierceness of passion, “on
my honour as a gentleman, I swear that the offer I ere now made
you was dictated by a feeling of friendship! Yes—of a friendship that
sprang up in my soul in a single instant—that took birth in a moment
—a friendship that prompted me to declare how proud and delighted
I should be to act as your escort! For I am candid, frank, and
ingenuous as I perceive you to be,—and I will give you another
proof of the existence of these qualities in respect to myself—even
at the risk of offending you. From the first moment that I set foot in
this room until now, I have experienced emotions such as I never
felt before. In my delirium I apostrophised you as an angel of
beauty;—and an angel of beauty must you indeed be to exercise
such prompt—such speedy—such witching influence as that which
has enthralled me. For it appears as if there were a spell upon me—
an enchantment, from which there is no escape. Sweet lady, pardon
me for having spoken thus frankly——”

“I again assure you that I do not very readily take offence,”


answered Perdita: then, laying her hand upon his—for the designing
woman sought to excite him almost to madness—and again
approaching her countenance so near his own that he could look
into the depth of her large, wanton eyes,—she said, “You have made
a certain avowal, and you have a right to expect a candid and
unreserved reply from me. Then learn, Mr. Hatfield, that never
should I have accepted your services as a chaperon—never should
we have talked thus familiarly—never would you have been suffered
to read so much of my disposition as within the last hour you have
learnt—had not I likewise experienced a feeling of friendship at first
sight for you!”
“Oh! my God—this is happiness so unhoped—so unlooked for—so
unexpected, that I am bewildered-dazzled—amazed!” murmured the
young man, a mist obscuring his brain—and yet a glorious, lustrous,
golden mist through which he seemed to catch glimpses of paradise.
“Friendship did you say, charming lady? Yet is not friendship a
dangerous word for lips like ours to breathe—and a dangerous
sentiment for hearts like ours to feel?”

“You speak as if you were under an apprehension that you are doing
wrong?” said Perdita, in a tone of soft reproach. “Oh! is this candour
and frankness? If you regret that you have pledged me your
friendship—for such I augur of your words—I release you, Mr.
Hatfield, from the bond: nay—I should be too proud to ask you to
adhere to it!”

And now the young man beheld the fascinating woman in a new
phasis of her charms;—for, with that ready versatility of aspect and
demeanour which she had so completely at her command, she
suddenly invested herself with all the majesty of sublime
haughtiness;—no longer melting, tender, wanton, and voluptuous as
Venus—but terrible, domineering, superb, and imperious as Juno,—
no longer wearing the cestus of the Goddess of Love—but grasping,
as the Queen of Heaven, the thunders of Olympian Jove.

Her eyes flashed fire—her cheeks flushed—her nostrils dilated—her


lip curled—her neck arched proudly rather than gracefully—her
bosom heaved as if it would burst the low corsage which only half
restrained it—and her very form seemed to draw itself up into a
height, which, even as she sate and of middling stature as she was,
appeared colossal at that moment to the astounded gaze of the
young man.

Never was artifice more successful—never was triumph more


complete, on one side;—never was defeat more signal—never was
humiliation more contrite, on the other. For, overwhelmed as it were
by the sovereign majesty of that anger which he believed himself to
have provoked, Charles Hatfield fell upon his knees before the
haughty beauty, and seizing both her hands in his, he extravagantly
devoured them with kisses, exclaiming, “Pardon—pardon!”

“Yes—yes: it is as frankly accorded as sincerely demanded!”


exclaimed Perdita, not offering to withdraw her hands from the lips
which were now glued to them: and in an instant her whole manner
and appearance changed again—and when Charles Hatfield ventured
to look up into the syren’s face, he saw her bending over him with
cheeks flushed it is true, but not by anger—and with eyes that
seemed to swim in wanton, liquid languor.

Rising from his suppliant posture, and now taking a seat by the side
of Perdita on the sofa,—relinquishing her hands at the same time,
for fear of giving offence by retaining them,—the infatuated young
man, drunk with passion, said in a low murmuring tone, “We have
not been acquainted more than one hour, and we have exchanged
vows of friendship—is it not so?”

“Yes—if you do not repent now, and never will repent of that pledge
on your part,” answered the dangerous young woman, who thus
conducted her designing machinations with such consummate skill.

“No—never, never!” cried Hatfield. “And now we know each other as


well as if we had been intimate since our infancy! To you, then,
henceforth I am Charles; and you are to me——”

“Perdita,” said she.

“Oh! beautiful—singular—and yet ominous name!” exclaimed the


young gentleman. “Yes—you are my friend—my dear friend Perdita!
And now, Perdita, I will avail myself of this romantic yet not the less
sincere friendship that is established between us, to ask you what
caprice or fancy gave you so remarkable a Christian name?”

“Because in my infancy—shortly after my birth, and before I was


baptised—I was lost,—or rather stolen by gipsies,” answered Perdita,
investing herself and her history with as much of the charm of
mysticism as possible: “and when I was recovered from the
kidnappers by my parents, they christened me Perdita—or The Lost
One.”

“Every thing connected with you seems to be imbued with deep and
enthralling interest, my dear friend,” said Charles: “a supernatural
halo appears to surround you! Your beauty is of a nature so superior
to aught of female loveliness that I ever before beheld—your voice
has something so indescribably melting and musical that it awakens
echoes in the inmost recesses of the soul—your history is strange,
wild, and impressive in its very commencement—your disposition is
characterised by a frankness and candour so generous that it
inspires and reciprocates profound friendship the instant it meets a
kindred spirit—and then there is about you a something so witching,
so captivating, so enchanting, that the best and most virtuous of
men would lose all sense of duty, did you—sweet syren that you are
—undertake to lead them astray.”

“If I have indeed found a kindred spirit in you, Charles,” said Perdita,
taking his hand and pressing it as if in grateful and innocent rapture
to her heaving bosom—an act which only tended to inflame the
young man almost to madness,—“I shall have gained that which I
have long sought, and never yet found. For my heart has hitherto
been as complete a stranger to a sincere friendship as to love! When
I spoke ere now of our friends in the country, I meant those
acquaintances whom custom denominates by the other title.”

“Perdita—my friend Perdita, the amity that we have pledged each


other shall be eternal!” exclaimed Charles, in an impassioned tone.

“And you will return to visit me to-morrow?” said the young woman,
her fine grey eyes beaming with an unsettled lustre, as if the
mingled voluptuousness of day and night met in those splendid,
eloquent orbs.
“Yes—oh! yes!” cried Charles, as if it were unnecessary to have
asked the question. “And now I shall leave you, Perdita: I shall
depart to feast my imagination on the pleasures of this interview.”

Thus speaking, the young man pressed Perdita’s hand to his lips,
and hurried from the room, intoxicated with a delirium of bliss, and
scarcely conscious of where he was or whither he was going.
CHAPTER CXXXI.
THE SYREN’S ARTS AND CHARMS.

On gaining the street, Charles Hatfield hurried along like one


demented,—positively reeling with the influence which Perdita’s
charms, allurements, and arts had shed upon him,—and feeling
within his soul a glow of such ineffable happiness that he appeared
to have been snatched from the world and wafted to Elysium. Had
he just quitted a banquet where his head had been pillowed on the
bosom of beauty, and the fair hands of the charmer had held to his
lips brimming goblets of champagne of which he had drunk deeply,
he would not have experienced a more extraordinary degree of
excitement, nor such felicitous sensations.
But the moment of reaction came; and though the revulsion was
slow, yet it was powerful—and even painful.

He had found his way into Saint James’s Park; and hurrying to the
most secluded quarter, he was still giving rein to the luxuriousness of
his thoughts, when it suddenly flashed to his mind that he had not
received from the lips of Mrs. Fitzhardinge the important
communications which she had promised him. Indeed, he had not
seen her again from the moment when she showed him into the
drawing-room where he had found the lovely creature to whom his
friendship—his eternal friendship was so solemnly plighted.

Striking his repeater,—for obscurity reigned in that portion of the


park where he now was, and he could not see the position of the
hands of his watch,—he was amazed to discover that his interview
with Perdita had lasted two hours.

Two hours!—and it scarcely seemed to have occupied ten minutes!

But now his reasoning faculties returned;—and he began to ask


himself innumerable questions.

“Wherefore was I conducted to that house? was it really to receive


important revelations from the mother? or only to be thrown into the
way of the daughter? Why did not the mother make her appearance
once during those two hours which I passed with the daughter? Was
it a stratagem devised by designing women to ensnare me? or was
Mrs. Fitzhardinge unexpectedly prevented from joining us so soon as
she had intended? My God! I am bewildered—I know not what to
think! For if they be women of evil repute and having sinister aims in
view, Perdita would not have given me to understand that they are
at ease in their circumstances, and hope to be even rich very
shortly? But that young creature—so beautiful,—so indescribably—so
enchantingly beautiful,—what object could she have in pledging her
friendship to me—to me, a stranger whom she had never seen
before? Fool that I am! wherefore did I give a similar promise to
her? Oh! it was in a moment of delirium—of enchantment—of
intoxication;—and might it not also have been the same with her?
Ah! that belief would denote a boundless vanity on my part;—and
yet women have their sudden caprices—their instantaneous
attachments, as well as men! Yes—it must be so—Perdita loves me!
—she loves me—and I already love her deeply—madly, in return!”

But scarcely had these thoughts passed through his brain, when his
heart smote him painfully—severely,—reproaching him with his
treachery towards Lady Frances Ellingham, and suggesting a
comparison between the retiring, bashful beauty of this charming
young creature, and the warm, impassioned, bold loveliness of the
syren Perdita.

The more Charles Hatfield pondered upon the strange scene that
had taken place in Suffolk Street, the less satisfied did he feel with
himself. He saw that his conduct had been rash, precipitate, and
thoughtless;—and yet there was something so pleasurable in what
he blamed himself for, that he was not altogether contrite. Indeed,
he felt—he admitted to his own secret soul, that had he the power
of recalling the last two hours, he should act precisely in the same
manner over again. For when he thought of Perdita,—remembered
her witcheries—dwelt on her faultless charms—and recalled to mind
the mystic fascination of her language and the delicious tones of her
voice,—his imagination grew inflamed—his blood ran rapidly and
hotly in his veins—and it seemed that were she Satan in female
shape, he could sell his soul to her!

It was late when he returned to Ellingham House; and he repaired at


once to his chamber. But he could not sleep: the image of Perdita
haunted him;—and were it not so unseasonable an hour he would
have returned to Suffolk Street under pretence of soliciting the
promised revelations from Mrs. Fitzhardinge.

When he retired to rest, and sleep did at last visit his eyes, that
beauteous image followed him in his dreams. He thought that he
was seated by the side of the witching fair one on the sofa, and that
she was reclining, half-embraced, on his breast, with her
countenance, flushed and wanton in expression, upturned towards
his own. This delicious position appeared to last for a long—long
time, neither uttering a word, but drinking deep draughts of love
from each other’s eyes. Then he fancied that he stooped to press his
lips to her delicious mouth;—but at that instant the lovely face
changed—elongating, and undergoing so horrible a transformation
that his eyes were fixed in appalling fascination upon it,—while, at
the same time, he became sensible that the soft and supple form
which he held in his arms was undergoing a rapid and signal change
likewise,—till the whole being, lately so charming, so tender, and so
loving, was changed into a hideous serpent. A terrible cry escaped
him—and he awoke!

The rays of the gorgeous sun were streaming in at the window, as


Charles Hatfield started from his slumber; and, to his surprise, he
found his father standing by the side of the bed.

“You have been labouring under the influence of an unpleasant


dream, Charles,” said Mr. Hatfield, taking his son’s hand.

“Yes—’twas indeed a hideous dream!” exclaimed the young man,


shuddering at the idea which still pursued him.

“And was that dream a reflex of any thoughts which occupy you
when awake?” asked his father, in a kind and anxious tone.

Charles surveyed his parent with astonishment, and then became


absolutely crimson in the face;—for this early and unusual visit
seemed to imply that its object was in some way connected with
matters that had lately been occupying, as the reader knows, no
inconsiderable share of the young man’s reflections—we mean, the
family secrets into which he had so strangely penetrated.

“Yes, Charles,” continued Mr. Hatfield; “I feared that you had


something upon your mind; and your manner now confirms that
apprehension. For the last week you have not been the same gay,
happy, lively being you so lately were;—and, although you have
endeavoured to conceal your sorrow from observation, yet it has not
escaped the eyes of your affectionate mother and myself. Tell me,
Charles—tell me candidly, I implore you—is it in consequence of the
discovery that we are your parents, and not mere relatives——”

“Oh! my dear father,” exclaimed the young man, “that discovery


made me happy, I solemnly assure you!”
“Then wherefore are you melancholy and thoughtful at times?”
asked Mr. Hatfield, in a tone of deep interest.

“Melancholy and thoughtful!” repeated Charles, mechanically.

“Yes, my dear son: and even at this moment——”

“Even at this moment,” still repeated Charles, whose imagination


was wandering to Suffolk Street, the influence of his dream having
been to fill his soul with a more profound terror than he had ever
before experienced from the worst of sleep’s delusions.

“Yes—even at this moment you are abstracted—your ideas are


unsettled—and there is a wildness in your looks which terrifies me!”
cried Mr. Hatfield, speaking with strong emphasis and in an earnest
manner. “Charles! again I implore you to tell me the cause of this
change which has so lately come over you!”

“Dear father, why will you press me on the subject?” cried the young
man, now brought to himself, yet knowing not how to reply. “Oh!
believe me—believe me, it will be better for us both that you do not
persist in questioning me!”

“On the contrary, Charles,” returned Mr. Hatfield, speaking more


seriously and firmly than before, “it will be far more satisfactory to
me—yes, and to your mother also—to be made the depositors of
your secret cares. You have assured me that you are not unhappy
on account of the discovery made on the day when the Prince of
Montoni was received at Court; and therefore I must conjecture the
existence of some other cause of grief. Charles, my dear boy,” added
his father, gazing steadfastly upon him, “you love Lady Frances—and
you are fearful of avowing your passion?”

The young man had expected that his father was about to speak on
some of those family matters into the mysterious depths of which he
had penetrated; and, therefore, when Mr. Hatfield addressed to him
that species of interrogative accusation, Charles experienced a relief
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!

ebookmasss.com

You might also like