Swindle Sample Run

This depicts a single run of the ereader.py file. Commentary about the run is interspersed throughout.

When a user begins, some customization of the ereader is done. This happens within the constructor of the Swindle class.

$ python3 ereader.py

Since this is the first time you used it,
let's customize your Swindle...

Please enter you name: Anna

Welcome to Anna's Swindle v1.0!

--------------------------------------------------

1) Buy/See available books
2) See owned books
3) Read a book
4) Exit

   ---> 2

You don't own any books!

Typically you will start each interaction with the ereader by purchasing some books.

The main menu for Swindle device is provided for you in the file ereader.py. It prints the menu and ensures that the user selects a valid choice. It calls Swindle methods that you will write to respond to the user's choice.

--------------------------------------------------

1) Buy/See available books
2) See owned books
3) Read a book
4) Exit

   ---> 1

Available books:
 1:       Alice in Wonderland by        Lewis Carroll (1865)
 2:       Pride and Prejudice by          Jane Austin (1813)
 3:                 Peter Pan by         J. M. Barrie (1922)
 4:                   Ulysses by          James Joyce (1922)
 5:    Mary Had a Little Lamb by   Sarah Josepha Hale (1830)

Which book would you like to buy? (0 to skip): 3

You've successfully purchased the book: Peter Pan

--------------------------------------------------

1) Buy/See available books
2) See owned books
3) Read a book
4) Exit

   ---> 1

Available books:
 1:       Alice in Wonderland by        Lewis Carroll (1865)
 2:       Pride and Prejudice by          Jane Austin (1813)
 3:                   Ulysses by          James Joyce (1922)
 4:    Mary Had a Little Lamb by   Sarah Josepha Hale (1830)

Which book would you like to buy? (0 to skip): 1

You've successfully purchased the book: Alice in Wonderland

You will implement the code that shows the user the available books, gets their selection, removes the purchased book from the list of available books, and adds the book into the list of owned books.

--------------------------------------------------

1) Buy/See available books
2) See owned books
3) Read a book
4) Exit

   ---> 1

Available books:
 1:       Pride and Prejudice by          Jane Austin (1813)
 2:                   Ulysses by          James Joyce (1922)
 3:    Mary Had a Little Lamb by   Sarah Josepha Hale (1830)

Which book would you like to buy? (0 to skip): 0

Notice that after making a high-level choice to read or to buy, a user can change their mind, by selecting the skip option, which will return them back to the main menu.

--------------------------------------------------

1) Buy/See available books
2) See owned books
3) Read a book
4) Exit

   ---> 3

The number of books available to buy or to read will change as the user interacts with the ereader. When a user is picking which book to read or to buy, you must ensure that they are making a valid choice.

Books you own:
 1:                 Peter Pan by         J. M. Barrie (1922)
 2:       Alice in Wonderland by        Lewis Carroll (1865)

Which book would you like to read? (0 to skip): 4
invalid input, try again
Which book would you like to read? (0 to skip): 2


CHAPTER I. Down the Rabbit-Hole

Alice was beginning to get very tired of sitting by her sister on the
bank, and of having nothing to do: once or twice she had peeped into the
book her sister was reading, but it had no pictures or conversations in
it, 'and what is the use of a book,' thought Alice 'without pictures or
conversation?'

So she was considering in her own mind (as well as she could, for the
hot day made her feel very sleepy and stupid), whether the pleasure
of making a daisy-chain would be worth the trouble of getting up and
picking the daisies, when suddenly a White Rabbit with pink eyes ran
close by her.

There was nothing so VERY remarkable in that; nor did Alice think it so
VERY much out of the way to hear the Rabbit say to itself, 'Oh dear!
Oh dear! I shall be late!' (when she thought it over afterwards, it
occurred to her that she ought to have wondered at this, but at the time

Showing page 0 out of 166

n (next); p (previous); q (quit): n

You do not need to write the code that displays the text one page at a time and gets a one-letter command from the reader about how to proceed. This code is provided for you in the Swindle class.

it all seemed quite natural); but when the Rabbit actually TOOK A WATCH
OUT OF ITS WAISTCOAT-POCKET, and looked at it, and then hurried on,
Alice started to her feet, for it flashed across her mind that she had
never before seen a rabbit with either a waistcoat-pocket, or a watch
to take out of it, and burning with curiosity, she ran across the field
after it, and fortunately was just in time to see it pop down a large
rabbit-hole under the hedge.

In another moment down went Alice after it, never once considering how
in the world she was to get out again.

The rabbit-hole went straight on like a tunnel for some way, and then
dipped suddenly down, so suddenly that Alice had not a moment to think
about stopping herself before she found herself falling down a very deep
well.

Either the well was very deep, or she fell very slowly, for she had
plenty of time as she went down to look about her and to wonder what was
going to happen next. First, she tried to look down and make out what
she was coming to, but it was too dark to see anything; then she

Showing page 1 out of 166

n (next); p (previous); q (quit): n

In subsequent examples, only the first and last line of the page will be shown so as to make the structure of the sample run easier to view.

looked at the sides of the well, and noticed that they were filled with
    [middle lines removed]
was no one to listen to her, still it was good practice to say it over)

Showing page 2 out of 166

n (next); p (previous); q (quit): n

'--yes, that's about the right distance--but then I wonder what Latitude
    [middle lines removed]
mice in the air, I'm afraid, but you might catch a bat, and that's very

Showing page 3 out of 166

n (next); p (previous); q (quit): p

While reading a book, a user can move backwards (by selecting p for previous) or forwards (by selecting n for next) through the pages.

looked at the sides of the well, and noticed that they were filled with
    [middle lines removed]
was no one to listen to her, still it was good practice to say it over)

Showing page 2 out of 166

n (next); p (previous); q (quit): q

Setting bookmark in Alice in Wonderland at page 2

Whenever a user quits reading a particular book, the current page number is returned. You will need to set the bookmark at that page so that when the user returns to that book, they will resume reading at the same page where they left off. For Alice in Wonderland the reader has quit at page 2.

--------------------------------------------------

1) Buy/See available books
2) See owned books
3) Read a book
4) Exit

   ---> 3

Books you own:
 1:                 Peter Pan by         J. M. Barrie (1922)
 2:       Alice in Wonderland by        Lewis Carroll (1865)

Which book would you like to read? (0 to skip): 1
Chapter 1 PETER BREAKS THROUGH

All children, except one, grow up. They soon know that they will grow
up, and the way Wendy knew was this. One day when she was two years old
she was playing in a garden, and she plucked another flower and ran with
it to her mother. I suppose she must have looked rather delightful, for
Mrs. Darling put her hand to her heart and cried, "Oh, why can't you
remain like this for ever!" This was all that passed between them on
the subject, but henceforth Wendy knew that she must grow up. You always
know after you are two. Two is the beginning of the end.

Of course they lived at 14 [their house number on their street], and
until Wendy came her mother was the chief one. She was a lovely lady,
with a romantic mind and such a sweet mocking mouth. Her romantic
mind was like the tiny boxes, one within the other, that come from the
puzzling East, however many you discover there is always one more; and
her sweet mocking mouth had one kiss on it that Wendy could never get,
though there it was, perfectly conspicuous in the right-hand corner.

The way Mr. Darling won her was this: the many gentlemen who had been

Showing page 0 out of 308

n (next); p (previous); q (quit): n

boys when she was a girl discovered simultaneously that they loved her,
   [middle lines removed]
Darling's guesses.

Showing page 1 out of 308

n (next); p (previous); q (quit): q

Setting bookmark in Peter Pan at page 1

--------------------------------------------------

1) Buy/See available books
2) See owned books
3) Read a book
4) Exit

   ---> 3

Books you own:
 1:                 Peter Pan by         J. M. Barrie (1922)
 2:       Alice in Wonderland by        Lewis Carroll (1865)

Which book would you like to read? (0 to skip): 2

The ereader begins re-reading Alice in Wonderland at page 2, based on the bookmark set previously.

looked at the sides of the well, and noticed that they were filled with
   [middle lines removed]
was no one to listen to her, still it was good practice to say it over)

Showing page 2 out of 166

n (next); p (previous); q (quit): n

'--yes, that's about the right distance--but then I wonder what Latitude
    [middle lines removed]
mice in the air, I'm afraid, but you might catch a bat, and that's very

Showing page 3 out of 166

n (next); p (previous); q (quit): q

Setting bookmark in Alice in Wonderland at page 3

--------------------------------------------------

1) Buy/See available books
2) See owned books
3) Read a book
4) Exit

   ---> 4