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.
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:
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.
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.
When using if statements you have to indent your code as follows:
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?
The Science and Technology section of the library is growing. The librarian decides to have five sub-sections for this section as follows:
Extend your code further to include these five subcategories in your algorithm. (See below for a full list of all the required genres.)
To do so you will need to indent your code further as follows. This is called nested indentation:
Solution...The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area