0% found this document useful (0 votes)
25 views64 pages

Tiny Python Projects Learn Coding and Testing With Puzzles and Games 1st Edition Ken Youens Clark

The document promotes the book 'Tiny Python Projects' by Ken Youens-Clark, which teaches coding and testing through puzzles and games. It provides a link for ebook downloads and additional resources from Manning Publications. The book covers various programming topics, including working with strings, lists, dictionaries, and files, along with practical exercises.

Uploaded by

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

Tiny Python Projects Learn Coding and Testing With Puzzles and Games 1st Edition Ken Youens Clark

The document promotes the book 'Tiny Python Projects' by Ken Youens-Clark, which teaches coding and testing through puzzles and games. It provides a link for ebook downloads and additional resources from Manning Publications. The book covers various programming topics, including working with strings, lists, dictionaries, and files, along with practical exercises.

Uploaded by

culeachoyon
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/ 64

Read Anytime Anywhere Easy Ebook Downloads at ebookmeta.

com

Tiny Python Projects Learn coding and testing with


puzzles and games 1st Edition Ken Youens Clark

https://ebookmeta.com/product/tiny-python-projects-learn-
coding-and-testing-with-puzzles-and-games-1st-edition-ken-
youens-clark/

OR CLICK HERE

DOWLOAD EBOOK

Visit and Get More Ebook Downloads Instantly at https://ebookmeta.com


Learn coding and testing with puzzles and games

Ken Youens-Clark

MANNING

Tiny Python Projects

KEN YOUENS-CLARK

MANNING
SHELTER ISLAND

For online information and ordering of this and other Manning books,
please visit

www.manning.com. The publisher offers discounts on this book when


ordered in quantity.

For more information, please contact

Special Sales Department

Manning Publications Co.

20 Baldwin Road

PO Box 761

Shelter Island, NY 11964

Email: orders@manning.com

©2020 by Manning Publications Co. All rights reserved.

No part of this publication may be reproduced, stored in a retrieval


system, or transmitted, in any form or by means electronic,
mechanical, photocopying, or otherwise, without prior written
permission of the publisher.

Many of the designations used by manufacturers and sellers to


distinguish their products are claimed as trademarks. Where those
designations appear in the book, and Manning Publications was
aware of a trademark claim, the designations have been printed in
initial caps or all caps.

Recognizing the importance of preserving what has been written, it is


Manning’s policy to have the books we publish printed on acid-free
paper, and we exert our best efforts to that end.
Recognizing also our responsibility to conserve the resources of our
planet, Manning books are printed on paper that is at least 15
percent recycled and processed without the use of elemental
chlorine.

Development editor: Elesha Hyde

Technical development editor: Al Scherer

Manning Publications Co.

Review editor: Aleksandar Dragosavljevic´

20 Baldwin Road

Production editor: Deirdre S. Hiam

PO Box 761

Copy editor: Andy Carroll

Shelter Island, NY 11964

Proofreader: Katie Tennant

Technical proofreader: Mathijs Affourtit

Typesetter: Dennis Dalinnik

Cover designer: Marija Tudor

ISBN: 9781617297519

Printed in the United States of America

brief contents

Getting started: Introduction and installation guide


1

How to write and test a Python program

15

The crow’s nest: Working with strings

35

Going on a picnic: Working with lists

55

Jump the Five: Working with dictionaries

76

Howler: Working with files and STDOUT


92

Words count: Reading files and STDIN, iterating lists,

formatting strings

107

Gashlycrumb: Looking items up in a dictionary 118

Apples and Bananas: Find and replace

128

Dial-a-Curse: Generating random insults from

lists of words

150

10


Telephone: Randomly mutating strings

165

11

Bottles of Beer Song: Writing and

testing functions

178

12

Ransom: Randomly capitalizing text

195

13

Twelve Days of Christmas: Algorithm design

207

iii

iv

BRIEF CONTENTS

14


Rhymer: Using regular expressions to create

rhyming words

225

15

The Kentucky Friar: More regular expressions

248

16

The Scrambler: Randomly reordering the middles

of words

268

17

Mad Libs: Using regular expressions

281

18

Gematria: Numeric encoding of text using

ASCII values
295

19

Workout of the Day: Parsing CSV files, creating

text table output

311

20

Password strength: Generating a secure and

memorable password

331

21

Tic-Tac-Toe: Exploring state

351

22

Tic-Tac-Toe redux: An interactive version

with type hints

367
contents

preface

xv

acknowledgments

xvii

about this book

xix

about the author

xxii

about the cover

xxiii

Getting started: Introduction and installation guide

Writing command-line programs

Using test-driven development

Setting up your environment

Code examples
5

Getting the code

Installing modules

10

Code formatters

10

Code linters

11

How to start writing new programs

11

Why not Notebooks?

12

The scope of topics we’ll cover

12

Why not object-oriented programming?

13

A note about the lingo

13

v
vi

CONTENTS

1 How to write and test a Python program 15

1.1

Creating your first program

15

1.2

Comment lines

16

1.3

Testing your program

17

1.4

Adding the #! (shebang) line

18

1.5

Making a program executable

20

1.6

Understanding $PATH
20

Altering your $PATH

21

1.7

Adding a parameter and help

22

1.8

Making the argument optional

24

1.9

Running our tests

26

1.10

Adding the main() function

26

1.11

Adding the get_args() function

27

Checking style and errors

28
1.12

Testing hello.py

29

1.13

Starting a new program with new.py

30

1.14

Using template.py as an alternative to new.py

33

2 The crow’s nest: Working with strings 35

2.1

Getting started

36

How to use the tests

36 ■ Creating programs with new.py

37

Write, test, repeat

38 ■ Defining your arguments

39

Concatenating strings
41 ■ Variable types

42 ■ Getting

just part of a string

43 ■ Finding help in the REPL

44

String methods

44 ■ String comparisons

45 ■ Conditional

branching

47 ■ String formatting

48 ■ Time to write

49

2.2

Solution

49

2.3

Discussion

50

Defining the arguments with get_args()

50 ■ The main()
thing

51 ■ Classifying the first character of a word

51

Printing the results

52 ■ Running the test suite

52

2.4

Going further

53

3 Going on a picnic: Working with lists 55

3.1

Starting the program

56

3.2

Writing picnic.py

58

CONTENTS

vii

3.3

Introducing lists
59

Adding one element to a list

60 ■ Adding many elements to a

list

61 ■ Indexing lists

63 ■ Slicing lists

64 ■ Finding

elements in a list

64 ■ Removing elements from a list

65

Sorting and reversing a list

67 ■ Lists are mutable

69

Joining a list

70

3.4

Conditional branching with if/elif/else

70

Time to write

71
3.5

Solution

71

3.6

Discussion

73

Defining the arguments

73 ■ Assigning and sorting the items

73

Formatting the items

73 ■ Printing the items

74

3.7

Going further

75

4 Jump the Five: Working with dictionaries 76

4.1

Dictionaries

77

Creating a dictionary
78 ■ Accessing dictionary values

80

Other dictionary methods

81

4.2

Writing jump.py

82

4.3

Solution

84

4.4

Discussion

85

Defining the parameters

85 ■ Using a dict for encoding

85

Various ways to process items in a series

86 ■ (Not) using

str.replace()

90
4.5

Going further

91

5 Howler: Working with files and STDOUT 92

5.1

Reading files

93

5.2

Writing files

97

5.3

Writing howler.py

99

5.4

Solution

101

5.5

Discussion

102

Defining the arguments


102 ■ Reading input from a file or the

command line

103 ■ Choosing the output file handle

104

Printing the output

104 ■ A low-memory version

104

5.6

Going further

106

viii

CONTENTS

6 Words count: Reading files and STDIN, iterating lists,

formatting strings

107

6.1

Writing wc.py

109

Defining file inputs

110 ■ Iterating lists


111 ■ What you’re

counting

111 ■ Formatting your results

112

6.2

Solution

114

6.3

Discussion

115

Defining the arguments

115 ■ Reading a file using

a for loop

115

6.4

Going further

117

7 Gashlycrumb: Looking items up in a dictionary 118

7.1

Writing gashlycrumb.py
119

7.2

Solution

122

7.3

Discussion

123

Handling the arguments

123 ■ Reading the input file

124

Using a dictionary comprehension

125 ■ Dictionary

lookups

126

7.4

Going further

126

8 Apples and Bananas: Find and replace 128

8.1

Altering strings
130

Using the str.replace() method

131 ■ Using str.translate()

131

Other ways to mutate strings

132

8.2

Solution

133

8.3

Discussion

134

Defining the parameters

134 ■ Eight ways to replace

the vowels

135

8.4

Refactoring with tests

149

8.5
Going further

149

9 Dial-a-Curse: Generating random insults from

lists of words

150

9.1

Writing abuse.py

151

Validating arguments

153 ■ Importing and seeding the random

module

154 ■ Defining the adjectives and nouns

155 ■ Taking

random samples and choices

156 ■ Formatting the output

156

CONTENTS

ix

9.2

Solution
157

9.3

Discussion

159

Defining the arguments

159 ■ Using parser.error()

160

Program exit values and STDERR

160 ■ Controlling randomness

with random.seed()

161 ■ Iterating with range() and using

throwaway variables

162 ■ Constructing the insults

162

9.4

Going further

163

10 Telephone: Randomly mutating strings 165

10.1

Writing telephone.py
167

Calculating the number of mutations

168 ■ The mutation

space

169 ■ Selecting the characters to mutate

169

Mutating a string

172 ■ Time to write

173

10.2

Solution

173

10.3

Discussion

175

Mutating a string

175 ■ Using a list instead of a str

176

10.4

Going further
177

11 Bottles of Beer Song: Writing and testing functions 178

11.1

Writing bottles.py

179

Counting down

180 ■ Writing a function

181 ■ Writing

a test for verse()

182 ■ Using the verse() function

186

11.2

Solution

187

11.3

Discussion

189

Counting down

189 ■ Test-driven development

189
The verse() function

190 ■ Iterating through the verses

191

1,500 other solutions

194

11.4

Going further

194

12 Ransom: Randomly capitalizing text 195

12.1

Writing ransom.py

197

Mutating the text

197 ■ Flipping a coin

198 ■ Creating

a new string

198

12.2

Solution

199
12.3

Discussion

200

Iterating through elements in a sequence

200 ■ Writing a function

to choose the letter

202 ■ Another way to write list.append()

202

Using a str instead of a list

203 ■ Using a list comprehension

203

Using a map() function

204

CONTENTS

12.4

Comparing methods

204

12.5

Going further
205

13 Twelve Days of Christmas: Algorithm design 207

13.1

Writing twelve_days.py

208

Counting

209 ■ Creating the ordinal value

211 ■ Making the

verses

213 ■ Using the verse() function

215 ■ Printing

215

Time to write

215

13.2

Solution

216

13.3

Discussion

218
Making one verse

218 ■ Generating the verses

221

Printing the verses

222

13.4

Going further

223

14 Rhymer: Using regular expressions to create rhyming


words 225

14.1

Writing rhymer.py

227

Breaking a word

228 ■ Using regular expressions

229

Using capture groups

232 ■ Truthiness

236 ■ Creating the

output
238

14.2

Solution

238

14.3

Discussion

240

Stemming a word

240 ■ Formatting and commenting the regular

expression

242 ■ Using the stemmer() function outside your

program

243 ■ Creating rhyming strings

244 ■ Writing

stemmer() without regular expressions

245

14.4

Going further

246

15 The Kentucky Friar: More regular expressions 248


15.1

Writing friar.py

250

Splitting text using regular expressions

251 ■ Shorthand

classes

252 ■ Negated shorthand classes

254 ■ Using re.split()

with a captured regex

255 ■ Writing the fry() function

256

Using the fry() function

261

15.2

Solution

262

15.3

Discussion

263

Writing the fry() function manually


264 ■ Writing the fry()

function with regular expressions

266

15.4

Going further

266

CONTENTS

xi

16 The Scrambler: Randomly reordering the middles of words


268

16.1

Writing scrambler.py

269

Breaking the text into lines and words

270 ■ Capturing, non-

capturing, and optional groups

272 ■ Compiling a regex

272

Scrambling a word

273 ■ Scrambling all the words


275

16.2

Solution

276

16.3

Discussion

277

Processing the text

277 ■ Scrambling a word

279

16.4

Going further

280

17 Mad Libs: Using regular expressions 281

17.1

Writing mad.py

282

Using regular expressions to find the pointy bits

284

Halting and printing errors


287 ■ Getting the values

288

Substituting the text

289

17.2

Solution

289

17.3

Discussion

290

Substituting with regular expressions

291 ■ Finding the

placeholders without regular expressions

291

17.4

Going further

293

18 Gematria: Numeric encoding of text using

ASCII values

295
18.1

Writing gematria.py

296

Cleaning a word

297 ■ Ordinal character values and

ranges

298 ■ Summing and reducing

300 ■ Using

functools.reduce

302 ■ Encoding the words

303

Breaking the text

304

18.2

Solution

304

18.3

Discussion

305

Writing word2num()
Other documents randomly have
different content
here when he came to make inquiries about the peacock. I made
Baldwin write to Sorley to appoint the thirteenth of November night
as the time to come up. Baldwin showed me the reply, and I knew
that he would be there. I took the stiletto which belonged to Sorley
as I stole it along with the peacock when I left this house. Since it
was his I thought it would make the evidence against him more
certain. I went to Rotherhithe and watched. I saw Sorley go, and
then I went up to Baldwin’s room and stabbed him. It doesn’t matter
how I cajoled him to lie down and rest, and chose my time. I
stabbed him to the heart and that is enough for you to know.”
Again her listeners shivered, for there seemed to be something
terrible about this small frail woman admitting such a dreadful deed
so callously and boldly. She smiled as she saw their feeling. “What a
lot of cowards you men are,” she jeered, “you wouldn’t have acted
so bravely; no, not you.”
“Go on, go on,” said Moon impatiently, “there’s no time to be lost.”
“I have nearly finished,” said Miss Grison tartly, “don’t hurry me,
as you must admit that my confession is interesting. I killed Baldwin
with this,” she added, taking up the stiletto which lay on the table,
“and I took it away, along with the peacock, intending to hide both
in this house. Jotty—ungrateful little reptile that he is—saw me with
these when he came to Thimble Square to tell me of the murder. Ha!
ha! of the murder which I had committed. I wept and wailed, as I
was bound to do, since my dear brother had been murdered by
Sorley. Then came the inquest, and I said nothing, for I waited my
chance. The funeral took place here, and I stayed at Mrs.
Millington’s, she has been a good friend to me. I came to this house
on the day you know of, Mr. Fuller,” she went on, addressing herself
to Alan who nodded in answer, “and while you and Marie were in the
grounds, and this man—if he can be called a man—was asleep, I
placed the peacock in that black-oak cupboard and the stiletto in the
place behind that panel marked with a cross, where I knew Sorley
kept those bits of glass——”
“They are jewels, valuable jewels,” cried her husband irrelevantly.
“Oh, get on with the confession,” said Latimer sharply, for the
prolonged scene was getting on his nerves, “you hid the stiletto and
peacock.”
“Yes,” said Miss Grison snappishly, “and then I waited, guessing
that Sorley would probably seek Mr. Fuller’s help to solve the riddle
of the bird. That was why I introduced the subject of cryptograms
on that day when we were at tea, Mr. Fuller. When I learned that
Jotty had Sorley’s reply to the request of Baldwin I sent him to you
so that it might implicate this beast of a husband of mine. Then
when Jotty told me about the drawing of the peacock, I knew that
Sorley had consulted you, since no drawing had ever been made of
the thing. My trap was set, and by making the matter of the peacock
public, I closed it on the man I hate.”
She shut her mouth with a snap, and idly dug the stiletto into the
table as if she had finished. “What else?” questioned Moon
imperiously.
“Nothing else,” said Miss Grison raising her pale eyes; “you know
all. The trap caught the bird, and my revenge would have been
complete had not this fool learned more than he should have. You, I
mean, you,” said Miss Grison walking slowly towards the Indian,
“why couldn’t you let me have my way?”
“I wanted the jewels,” said Bakche stolidly, and not moving even
when she was face to face with him.
“You shall never have them,” cried Miss Grison unexpectedly, and
before anyone could move she raised her arm. In a moment the
stiletto was in the Indian’s heart, and he fell like a log on the floor.
“Great God!” roared the inspector and sprang forward.
Miss Grison put out her frail arms. “Go on, put the handcuffs
here,” she mocked coolly. “I have settled the beast who balked me
of my revenge!”
“He is quite dead,” said Alan lifting a pale face from an
examination.
“And that beast Sorley lives,” snarled Miss Grison viciously, and
spat at her husband.
CHAPTER XXII
CALM AFTER STORM

In the month of July the park of The Monastery was in full


leafage, and presented a glorious sea of shimmering tremulous
green. The gardens glowed with many-colored blossoms, and
especially there was a profusion of roses, red and white and yellow,
for Marie Inderwick, loving flowers, had planted quantities
immediately after her return home from the Brighton school. The
whole place was radiant with color under a cloudless and deeply
blue sky, and the hot sunshine bathed everything in hues of gold. It
was like the Garden of Eden, and neither Adam nor Eve were
wanting, since the lovers were walking therein, arm in arm, talking
of the past, congratulating themselves on the present, and looking
forward to a serene and glorious future. The storm was over, and
now a halcyon calm prevailed.
“It’s like heaven,” sighed Miss Inderwick, whose face glowed like
one of the roses she wore at her breast, from sheer happiness, “and
to think that we shall be married to-morrow, Alan dearest.”
“Then it will be more like heaven than ever,” laughed the young
man, who looked the picture of content. “Let us go to St. Peter’s
Dell, Marie darling; for it was there that we found the jewels.”
“Rather the papers which led to the finding of the jewels,”
corrected Miss Inderwick gladly, “and it’s a nice place to make love
in, Alan, for I have planted it with roses.”
“The Gardens of Shiraz, where Omar Khayyam sang,” said the
happy young lover, and quoted the well known lines softly:—
“Here with a loaf of bread, beneath the bough,
A flask of wine: a book of verse—and Thou,
Beside me singing in the wilderness,
And wilderness is Paradise enow.”
“Oh, we don’t want the bread and wine,” laughed Marie indolently,
as they took their way to the dell along a path riotous with blossom.
“Bread and cheese then.”
“You have left out the best thing, dear.”
“Kisses, eh? Well then.” Alan stopped, took her into his strong
arms and kissed her twice, thrice, and again on her rose-leaf lips.
“I wish you’d behave yourself,” said Marie sedately, “as to bread
and cheese we have something better than that now.”
“You have,” said Alan quickly, “the jewels have brought close on
one hundred thousand pounds, which all belong to you.”
“What is mine is yours, darling. You know that.”
“Yet nasty people will say that I married you for your money,
Marie.”
She pouted. “What a compliment to me, as if I were an ugly girl.”
“Quite so, instead of being the most perfect woman ever created.”
“Oh,” Marie sighed from sheer pleasure, “say that again.”
Alan did so with a laugh. “Marie, will you ever have enough
flattery.”
“It’s not flattery, it’s the truth, and I like you always to tell me the
truth,” said Marie as they entered the dell. “Come and sit down on
the edge of the pool, Alan, and have a talk.”
“Why not call it the well?” he asked, while they balanced
themselves on the circle of stones, and he placed his arm round her
waist to support her.
“Simon Ferrier called it the pool, and I think it’s a very good
name.”
“Darling, he only did so because he was unable to find the name
of a gem which began with ‘W’.”
“I’m very glad he did,” said Marie quickly, “and that he could not
find one which began with ‘K’. If he had we should never have
solved the riddle.”
“Oh, don’t let us talk any more about the riddle or the sad events
connected with it,” cried Fuller, a shade passing over his happy face;
“let us leave the past alone and live in the present.”
“I am living in the future when we shall be husband and wife.”
“That desirable state of things will come into being to-morrow.”
“I know,” Marie nestled in her lover’s arms. “But I want to talk of
all that has happened Alan. Then we will say no more about it.”
“But, Marie, we have talked over everything again and again.”
“I dare say; but I want to ask questions and to be quite satisfied
in my own mind that everything disagreeable is at an end.”
“Very good,” said Alan, resigning himself to the inevitable with a
good grace, for he knew Marie’s obstinacy of yore. “What do you
wish to say?”
“Well, in the first place, I am still sorry that poor Mr. Bakche did
not live to get his share of the jewels. For you know, Alan, they
really did belong to him as a descendant of the Rajah of Kam.”
“My dearest, the jewels were legally assigned to George Inderwick
for a very great service. I am sure that the Rajah of Kam in those
days would rather have lost his jewels than his wife and only son. As
to Bakche, I am sorry that he died in so terrible a way, and had he
lived, undoubtedly I should have kept the promise made on your
behalf and handed over one third of the treasure. But Bakche did
not act well, or honorably.”
“What do you mean?” asked Marie opening her azure eyes very
widely, “If he had not spoken out, poor Uncle Ran might have been
hanged.”
“Quite so, dear. But he only spoke out when bribed to do so. He
knew all along that Miss Grison was guilty, and yet held his tongue.”
“He wouldn’t have done so had Uncle Ran been brought to trial?”
Alan smiled grimly. “I shouldn’t like to have given him the chance,”
he said in a skeptical tone. “Bakche, like most people, acted in an
entirely selfish way, and was ready to sacrifice every one for the
sake of gaining his own ends. Had Miss Grison given him the
peacock, and had he solved the riddle and secured the jewels, he
would not have confessed what he knew.”
“But Jotty might have done so.”
“It’s not improbable,” admitted Fuller musingly. “Jotty was
wonderfully greedy, and was willing to sell anyone for quids, as he
called them. He certainly sold Miss Grison for the sake of the few
gems your uncle gave him. However, let us hope that the
reformatory Inspector Moon has placed him in will improve him into
a decent member of society. He’s sharp enough and clever enough
to do well in the world.”
“But he hasn’t had a fair chance, dear.”
“Perhaps not; but he has one now. Miss Grison gave him one also,
but only because he knew too much and the brat was aware that he
had her under his thumb. However, Marie, I have told Moon that
when Jotty improves you and I will give him enough money to go to
America and make a new start. So that disposes of Jotty.”
“I wonder Miss Grison didn’t stick that horrid stiletto into him,”
said Miss Inderwick with a shudder “seeing how he betrayed her.”
“He would not have done so had not Bakche told his story, and it
was Bakche she hated most. It was truly wonderful how cunningly
she managed to get close to the man to stab him. None of us
thought when she walked up to him so quietly that she intended
murder. And she drove it right into his heart, weak as she was. I
expect,” added Alan musingly, “that is what Bakche meant when he
said that a weak arm could drive a stiletto into a sleeping man as
easily as a strong one could. I thought at the time he meant Jotty,
but he referred to Miss Grison, little thinking that the very next day
she would prove the truth of his words on himself.”
“But she was mad, Alan, quite mad.”
“So it was proved at the trial,” said Fuller with a shrug, “but I have
my suspicion, Marie, that Miss Grison was acting a part. I don’t think
that her brain was quite properly balanced, but her cunning in
planning and plotting to implicate your uncle in the crime very nearly
succeeded. She certainly was not mad when she acted in that way.”
“Mad people are always cunning and clever; Alan,” insisted Miss
Inderwick.
“Well, let us give Miss Grison the benefit of the doubt. She can do
no more harm now that she is shut up in that asylum as a criminal
lunatic, and your uncle must be relieved to think she is safely out of
the way.”
“All the same he has gone to live in Switzerland in a little
mountain hotel, my dear,” said Marie nodding wisely. “He told me
that he never would be satisfied until he had placed the ocean
between him and his unhappy wife, and chose Switzerland as the
best place to stay in.”
“Which means that he has only placed the Channel between him
and his bugbear,” said Fuller dryly. “Well, Marie, I can’t say that I am
sorry Mr. Sorley came to that determination, as it leaves us The
Monastery to ourselves, and such is his dread lest his wife should
escape that he will never come to England again, even for a visit.”
“I don’t think you are quite fair to Uncle Ran, dear.”
“Marie, you have said that again and again, and there is no truth
in it, I assure you. I have every desire to be fair to the miserable
man, and so has Dick, let alone my father and mother. But now that
his deeds have come to light they all mistrust him. He certainly did
not murder Baldwin Grison, but he assuredly ruined his life by
driving him away, even though the poor wretch gave certain
provocation for his dismissal. And you can’t say that he behaved well
to his wife. He married her for her good looks, and then grew weary
of her, as such a selfish man would. When he had her under his
thumb through the love she bore her brother, which impelled her to
save him from arrest for forgery by sacrificing herself, your Uncle
Ran, whom you think so highly of——”
“No I don’t. But I’m sorry for him, dear.”
“I don’t think he needs your sorrow, or deserves your pity,” said
Alan in a grave tone. “He was quite ready to commit bigamy for
money because he knew that Mrs. Sorley would not speak of her
marriage on account of the hold he had over Baldwin. Luckily the
rich girl he wished to marry died, so another complication was
avoided. He is selfishly happy in Switzerland with his jewels, and
because he knows that the woman he wronged so deeply is shut up.
I think we may as well do our best to forget Uncle Ran.”
“Yes, but Alan, he was very good to me as my guardian.”
“I don’t agree with you, Marie, and if you think so, it shows what
a truly sweet nature you have. He sold furniture which belonged to
you and took your income, and kept you short in every way. He
didn’t bully you, I admit, but he didn’t look after your welfare in any
manner whatsoever. You know that what I say is true.”
“Yes,” sighed Marie. “Well then, we won’t talk any more about
him. I know that he is quite happy where he is, and I’m sure I don’t
want him to come and make an inconvenient third in our lives, Alan.”
“He won’t,” her lover assured her seriously. “He is far too much
afraid of Miss Grison, or rather Mrs. Sorley, escaping from her
asylum. He is out of our lives, Marie, and as he is happy in his own
selfish way, why there is no more to be said. There are plenty of
pleasanter subjects to talk about, my dear. Indeed, I never liked
your uncle, and I always mistrusted him, as I had every reason to.”
“I shan’t talk of him any more, as I know you are right. And now
that the jewels have sold so well and we have plenty of money we
can repair The Monastery and improve the grounds, and you can be
country squire.”
“My dear, I am a solicitor, and I shall always be one. I can’t live on
my wife, you know.”
“But Alan, you will be away all the week.”
“Not at all. I can come down every night. It isn’t a long run to
town.”
“I want you all to myself here,” pouted Marie, “what’s the use of
my having this horrid money unless I can have you. And half of it is
yours, Alan, for unless you had solved the riddle it would not have
come into my possession.”
The young man was quiet for a few moments revolving what she
had said. Much as he liked his profession, he secretly admitted that
it would be very pleasant to play the part of a country gentleman.
And certainly the discovery of the jewels was due to him. Also it was
he who had saved the girl’s uncle from a disagreeable death, and
thus had prevented her from suffering a life-long shame and regret.
Finally there was much to be done in connection with the house and
the park and with certain lands which Marie wished to buy back, as
having belonged to former spendthrift Inderwicks. Alan thought that
he could do a great deal of good as the squire of Belstone, especially
as his father was the vicar of the parish. Therefore he began to
consider that it would not be a bad thing to give up the dingy office
in Chancery Lane and come back to the land.
“And of course I could enter Parliament,” he muttered, following
his line of thought. “Yes I could do good there.”
“Of course,” cried Marie, clapping her hands, and guessing what
he had been thinking about, “and perhaps you’ll get into the Cabinet
and the King may give you a title and——”
“And the moon is made of green cheese,” laughed Alan, giving her
a hug. “I dare say I shall give up the law, Marie, since you wish it,
and we can do a lot of good down here on your money.”
“Yours also, darling, yours also.”
“Very well, mine also. But we can talk of this on our honeymoon
when we are strolling over those glorious Cornish moors. Now,
Marie, let us go back to the house. You know Dick is coming to be
my best man, and he is bound to walk over here as soon as he
arrives at the vicarage.”
“I asked him to come with your father and mother, who are due
here to afternoon tea,” said Marie slipping off the circle of stones.
“Oh!” Alan looked at his watch. “Four o’clock. Then I expect they
have arrived. Come along, my darling.”
“Only one more question,” said Marie as they, walked away from
the dell.
“What is it?”
“You know that Simon Ferrier went back to India after burying the
gems.”
“He didn’t bury them, he put them in Yarbury’s Bank, dear. You
forget.”
“Well, you know what I mean,” said Marie impatiently. “He hid the
gems so that Julian Inderwick wouldn’t get them.”
“Yes; that’s old history. Well?”
“Well,” echoed Marie. “Simon Ferrier went back to tell George
Inderwick where the jewels were to be found and never anticipated
capture.”
“True, oh queen! But what does all this lead to?”
“To this! Simon Ferrier had arranged the enigma of the peacock
before he left England, and at a time when he never anticipated that
he would have any difficulty in speaking personally to his master.”
“I see what you mean. Well, my dear, all I can suppose is, that
Ferrier was an over-cautious man, and made ready the enigma in
case anything should prevent his reaching George Inderwick, as he
certainly never did. When in captivity he worked out his scheme with
the ring and the peacock exactly as he had planned it in England.”
“But there was no need to when he was here,” insisted Marie.
“No. But as I said before Simon Ferrier undoubtedly was an over-
cautious man; witness the fact that he made so ingenious a
cryptogram—if it can be called so—that even the man he designed
to benefit could not solve it. And in its very ease lay its difficulty. I
can’t answer your question in any other way, dear. Not that it
matters. We have the money, and everything is right, so let us enjoy
our good fortune, and be thankful that none of those wasteful
ancestors of yours solved the riddle. Had they done so I fear you
would not be so rich.”
“I think that is very true,” said Marie with a laugh; “but here we
are, darling, and there is Mr. Latimer.”
It was indeed Dick arrayed in white flannels looking big and burly
and genial, and more like a good-natured bear than ever. He held
out a hand to each at the same time, and walked towards the house
between them. “How are the happy pair?” he asked gaily.
“We won’t be a truly happy pair until to-morrow,” said Alan.
“Speak for yourself, dear,” said Marie lightly. “I am happy enough
now.”
“You deserve to be,” said Dick smiling, “for you have come
through a lot of trouble, and that always makes hearts grow fonder.
But do come and give me some tea, Mrs. Fuller—I beg your pardon,
Miss Inderwick, but you and Alan do look just like a married couple.”
“What’s that about marriage?” asked the vicar appearing at the
drawing-room door—the trio were in the house by this time, “have
Marie and Alan been studying the prayer-book.”
“Of course,” said the girl, running forward to kiss Mrs. Fuller. “I
know the ceremony by heart.”
“It’s more than I do,” wailed Latimer with a shrug, “and as best
man, I am sure to be a dismal failure.”
“Oh you’ll pull through somehow,” the future bridegroom assured
him.
“You must give me hints then. And when you are off for your
honeymoon to Cornwall, I shall find it dismal in those Barkers Inn
chambers all alone.”
“Get married yourself then,” advised the vicar.
“Upon my word I must think seriously about it,” said Dick. “What
do you say, Mrs. Fuller. Can’t you find me a nice girl?”
“Not one so nice as Marie,” said Mrs. Fuller, looking fondly at the
graceful form of Miss Inderwick as her hands hovered over the tea-
cups.
“No, I agree with you there, mother,” said Alan, taking up a plate
of bread and butter; “Marie is a rare bird.”
“A rare bird indeed. Why not a peacock?”
Mrs. Fuller shuddered. “Oh don’t talk of peacocks!”
“Why not?” asked the vicar, “all the happiness of the present is
really due to the peacock. Marie, my dear,” he observed as he took
his tea, “I used to laugh at the idea of your fetish, but really things
have come about so strangely that I think there is something in it.”
“Behold our benefactor,” cried Alan, pointing towards the bay-
window at the end of the vast room, and there on a pedestal under
a glass case was the famous bird, which had to do with so strange a
history.
And even as the young man spoke, there came a burst of
sunshine through the window which bathed the golden bird in
radiant light. The gems flashed out into rare beauty, and in the
dusky room, the fetish of the Inderwicks shone like a rare and
magnificent jewel. So unexpected was the sudden glow and glory
that everyone muttered a cry of admiration.
“It’s an omen!” cried Marie, “the omen of the peacock.”
“Let us drink its health in tea,” said Dick raising his cup.
And with laughter they all did so, applauding the beneficence of
the peacock, even though the vicar hinted that they were acting
heathenishly. The fetish of the Inderwicks radiated glory from its
gold and jewels in the burning sunshine until it glowed like a star of
happy destiny. And all present accepted the omen as a hint of the
future.

THE END
*** END OF THE PROJECT GUTENBERG EBOOK THE PEACOCK OF
JEWELS ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


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

Section 1. General Terms of Use and


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

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


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

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

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

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


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

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


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

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


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

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


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

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


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

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

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


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

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


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

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

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


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

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


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

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

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


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

1.F.

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


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

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


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

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


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

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

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


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


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

Volunteers and financial support to provide volunteers with the


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

Section 3. Information about the Project


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

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


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

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy