My Library

For this challenge you will work for the librarian who needs a computer program to help pupils find out where books can be found in the library.

MyLibrary

The library contains nine bookshleves labelled from A to I. Each bookshelf specialises in one genre. For instance, bookshelf A is for comedy fiction books.

Below is the list of bookshelves and genres:
MyLibrary-bookshelves

Your Task:


Your task is to write a computer program that asks the user if they are looking for a fiction or a non-fiction book. Based on the user answer the program will ask the user to choose the genre from a list of available genres. Finally the program will return the location (A to I) of books of this genre.

Learning Objectives


By completing this challenge you will use selection statements (if, elif and else). You will also use nested constructs by having if statements within if statements.

Let’s get coding


We have started the code for you but this code is incomplete: Can you complete the code to cater for all nine genres?

Extension Task:


The Science and Technology section of the library is growing. The librarian decides to have five sub-sections for this section as follows:

    H1: Biology Books
    H2: Physics Books
    H3: Chemistry Books
    H4: Computer Science Books
    H5: Design & Technology Books

Extend your code further to include these five subcategories in your algorithm. (See below for a full list of all the required genres.)

MyLibrary-bookshelves-2

Share Button
Posted in Computer Science, Python - Intermediate, Python Challenges Tagged with: ,

Our Latest Book