Book.py example
This example shows testing your completed lab. Here we will walk through buying available books, until we’ve bought all the books. This example also shows how you should handle invalid input when Buying/Seeing available books/
python3 ereader.py Since this is the first time you used it, let's customize your Swindle... Please enter you name: Vasanta Welcome to Vasanta's Swindle v1.0! -------------------------------------------------- 1) Buy/See available books 2) See owned books 3) Read a book 4) Exit ---> 1 1 GettysburgAddress Abraham Lincoln (1863) 2 Alice in Wonderland Lewis Carroll (1865) 3 Pride and Prejudice Jane Austin (1813) 4 Peter Pan J. M. Barrie (1922) 5 Ulysses James Joyce (1922) 6 Mary Had a Little Lamb Sarah Josepha Hale (1830) Which book would you like to buy? (0 to skip): 8 Please enter a valid choice from the options below 1 GettysburgAddress Abraham Lincoln (1863) 2 Alice in Wonderland Lewis Carroll (1865) 3 Pride and Prejudice Jane Austin (1813) 4 Peter Pan J. M. Barrie (1922) 5 Ulysses James Joyce (1922) 6 Mary Had a Little Lamb Sarah Josepha Hale (1830) Which book would you like to buy? (0 to skip): -3 Please enter a valid choice from the options below 1 GettysburgAddress Abraham Lincoln (1863) 2 Alice in Wonderland Lewis Carroll (1865) 3 Pride and Prejudice Jane Austin (1813) 4 Peter Pan J. M. Barrie (1922) 5 Ulysses James Joyce (1922) 6 Mary Had a Little Lamb Sarah Josepha Hale (1830) Which book would you like to buy? (0 to skip): 1 You've successfully purchased the book: GettysburgAddress -------------------------------------------------- 1) Buy/See available books 2) See owned books 3) Read a book 4) Exit ---> 1 1 Alice in Wonderland Lewis Carroll (1865) 2 Pride and Prejudice Jane Austin (1813) 3 Peter Pan J. M. Barrie (1922) 4 Ulysses James Joyce (1922) 5 Mary Had a Little Lamb Sarah Josepha Hale (1830) Which book would you like to buy? (0 to skip): 2 You've successfully purchased the book: Pride and Prejudice -------------------------------------------------- 1) Buy/See available books 2) See owned books 3) Read a book 4) Exit ---> 1 1 Alice in Wonderland Lewis Carroll (1865) 2 Peter Pan J. M. Barrie (1922) 3 Ulysses James Joyce (1922) 4 Mary Had a Little Lamb Sarah Josepha Hale (1830) Which book would you like to buy? (0 to skip): 4 You've successfully purchased the book: Mary Had a Little Lamb -------------------------------------------------- 1) Buy/See available books 2) See owned books 3) Read a book 4) Exit ---> 1 1 Alice in Wonderland Lewis Carroll (1865) 2 Peter Pan J. M. Barrie (1922) 3 Ulysses James Joyce (1922) Which book would you like to buy? (0 to skip): 2 You've successfully purchased the book: Peter Pan -------------------------------------------------- 1) Buy/See available books 2) See owned books 3) Read a book 4) Exit ---> 1 1 Alice in Wonderland Lewis Carroll (1865) 2 Ulysses James Joyce (1922) Which book would you like to buy? (0 to skip): 1 You've successfully purchased the book: Alice in Wonderland -------------------------------------------------- 1) Buy/See available books 2) See owned books 3) Read a book 4) Exit ---> 1 1 Ulysses James Joyce (1922) Which book would you like to buy? (0 to skip): 1 You've successfully purchased the book: Ulysses -------------------------------------------------- 1) Buy/See available books 2) See owned books 3) Read a book 4) Exit ---> 1 You've purchased all available books! -------------------------------------------------- 1) Buy/See available books 2) See owned books 3) Read a book 4) Exit ---> 2 1 GettysburgAddress Abraham Lincoln (1863) 2 Pride and Prejudice Jane Austin (1813) 3 Mary Had a Little Lamb Sarah Josepha Hale (1830) 4 Peter Pan J. M. Barrie (1922) 5 Alice in Wonderland Lewis Carroll (1865) 6 Ulysses James Joyce (1922) -------------------------------------------------- 1) Buy/See available books 2) See owned books 3) Read a book 4) Exit ---> 4