Write a Python module that stores books' titles and ISBN(10 digits) in the library first, then perform several operations.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write a Python module that stores books' titles and ISBN(10 digits) in the library first, then perform several operations.
The program should print a main menu that gives the librarian a list of options.

Option 1: Add books to the library
The librarian should be able to enter all books by title and unique ISBN space-separated. The ISBN must be unique, ten digits, and should contain numbers only. If the ISBN is not in the required format, or is duplicated, print ‘Invalid entry’ and keep prompting for valid entries until all books are entered.
Option 2: Print available books in the library
The librarian should be able to print all the available books in the library including the title and ISBN.
Option 3: Create book collections
The librarian should be able to create book collections. The program should first ask for the number of books per collection. Next, prompt the librarian to enter all the books in each collection using the book ISBN until there are no more books left in the library.
Option 4: Sort books in the collections
The librarian should be able to sort the books in a collection by ascending or descending order of ISBN. The program should prompt the librarian for the sorting order.
Option 5: Delete a collection
The librarian should be able to delete a book collection. Once a collection is deleted, it should be added back to the library of available books. If there is no collection available, the program should print ‘Invalid entry’.
Option 6:
The program should quit.

There is an image attached for the minimum required functions for this program, and example output.

A dictionary is recommended for the library. If the total number of books is not a multiple of the collection size, then the last collection will have fewer books.
If the librarian chooses option 2 while there are no books in the library, print ‘Invalid entry’.
A book can be in only one collection.
Books available in the library should change depending on whether collections are created or deleted.
When printing the book title and ISBN, the required alignment is 20 spaces per column. The program should always check all invalid operations.  Print the standard error message ‘Invalid entry’ for invalid operations.

*******************Main Menu*****演
1. Add books to the library
2. Print available books in the library
3. Create book collections
4. Sort books in the collections
5. Delete a collection
6. Quit
****
Choose a menu option: 1
How many books would you like to enter: 7
Enter book 5: Jack in the box 9123064100
Enter book 6: Nature AT2306510
Invalid entry
Enter book 1: Gemini 9123055800
Enter book 2: Facial Recognition 9123055810
Enter book 3: C++ Primer 9123055810
Invalid entry
Enter book 3: C++ Primer 9123055820
Enter book 4: Time 9123055830
Enter book 5: Jack in the box 9123064
Invalid entry
Enter book 6: Nature 9123065100
Enter book 7: Genetic Entropy 9123066100
****** **********Main Menu*****
1. Add books to the library
2. Print available books in the library.
3. Create book collections
4. Sort books in the collections
5. Delete a collection
6. Quit
****
Choose a menu option: 2
*******
Books available in the library:
Gemini
Facial Recognition
C++ Primer
Time
Jack in the box
Nature
Genetic Entropy
9123055800
9123055810
9123055820
9123055830
9123064100
9123065100
9123066100
******
*****
******
*******************Main Menu*******
1. Add books to the library
2. Print available books in the library
3. Create book collections
4. Sort books in the collections
5. Delete a collection
6. Quit
*****
Choose a menu option: 3
What is the size of the collection? 3
Enter the book ISBNs for collection 1:
9123055800
8123055826
Invalid entry
9123055820
9123064100
Enter the book ISBNs for collection 2:
9123065100
9123055810
9123055830
Enter the book ISBNs for collection 3:
9123066100
Current book collections:
Collection 1:
Gemini
Jack in the box
C++ Primer
Collection 2:
Nature
9123065100
9123055830
Time
Facial Recognition 9123055810
Collection 3:
Genetic Entropy
9123055800
9123064100
9123055820
****
9123066100
********Main Menu********:
Add books to the library
1.
2. Print available books in the library
3. Create book collections
4. Sort books in the collections
5. Delete a collection
*****
****
****
6. Quit
*****
Choose a menu option: 2
Invalid entry
*******
*******Main Menu***
*****:
1. Add books to the library
2. Print available books in the library
3. Create book collections
4. Sort books in the collections
5. Delete a collection
6. Quit
Current book collections:
Collection 1:
Choose a menu option: 4
Sort books in ascending or descending order of ISBN: ascending
Gemini
C++ Primer
Jack in the box
Collection 2:
Facial Recognition
Time
Nature
Collection 3:
Genetic Entropy
9123055800
9123055820
9123064100
9123055810
9123055830
9123065100
*****:
*********:
9123066100
**********Main Menu*****
*******
1. Add books to the library
2. Print available books in the library
3. Create book collections
4. Sort books in the collections
5. Delete a collection
6. Quit
******
******
*************
Choose a menu option: 5
Which collection would you like to delete? 8
Invalid entry
*******************Main Menu****************
1. Add books to the library
********
2. Print available books in the library
3. Create book collections
4. Sort books in the collections
5. Delete a collection
6. Quit
**********
Choose a menu option: 5
Which collection would you like to delete? 2
Current book collections:
Collection 1:
Gemini
C++ Primer
Jack in the box
Collection 2:
Genetic Entropy
9123055800
9123055820
9123064100
********** ******Main Menu***
1. Add books to the library
2. Print available books in the library
3. Create book collections
4. Sort books in the collections
5. Delete a collection
6. Quit
******
**********
912306610
Choose a menu option: 2
Books available in the library:
Facial Recognition 9123055810
Time
9123055830
Nature
9123065100
**********
6. Quit
1. Add books to the library
***
********Main Menu********
4. Sort books in the collections
5. Delete a collection
********
2. Print available books in the library
3. Create book collections
Choose a menu option: 6
End
****
********
********
********
Transcribed Image Text:*******************Main Menu*****演 1. Add books to the library 2. Print available books in the library 3. Create book collections 4. Sort books in the collections 5. Delete a collection 6. Quit **** Choose a menu option: 1 How many books would you like to enter: 7 Enter book 5: Jack in the box 9123064100 Enter book 6: Nature AT2306510 Invalid entry Enter book 1: Gemini 9123055800 Enter book 2: Facial Recognition 9123055810 Enter book 3: C++ Primer 9123055810 Invalid entry Enter book 3: C++ Primer 9123055820 Enter book 4: Time 9123055830 Enter book 5: Jack in the box 9123064 Invalid entry Enter book 6: Nature 9123065100 Enter book 7: Genetic Entropy 9123066100 ****** **********Main Menu***** 1. Add books to the library 2. Print available books in the library. 3. Create book collections 4. Sort books in the collections 5. Delete a collection 6. Quit **** Choose a menu option: 2 ******* Books available in the library: Gemini Facial Recognition C++ Primer Time Jack in the box Nature Genetic Entropy 9123055800 9123055810 9123055820 9123055830 9123064100 9123065100 9123066100 ****** ***** ****** *******************Main Menu******* 1. Add books to the library 2. Print available books in the library 3. Create book collections 4. Sort books in the collections 5. Delete a collection 6. Quit ***** Choose a menu option: 3 What is the size of the collection? 3 Enter the book ISBNs for collection 1: 9123055800 8123055826 Invalid entry 9123055820 9123064100 Enter the book ISBNs for collection 2: 9123065100 9123055810 9123055830 Enter the book ISBNs for collection 3: 9123066100 Current book collections: Collection 1: Gemini Jack in the box C++ Primer Collection 2: Nature 9123065100 9123055830 Time Facial Recognition 9123055810 Collection 3: Genetic Entropy 9123055800 9123064100 9123055820 **** 9123066100 ********Main Menu********: Add books to the library 1. 2. Print available books in the library 3. Create book collections 4. Sort books in the collections 5. Delete a collection ***** **** **** 6. Quit ***** Choose a menu option: 2 Invalid entry ******* *******Main Menu*** *****: 1. Add books to the library 2. Print available books in the library 3. Create book collections 4. Sort books in the collections 5. Delete a collection 6. Quit Current book collections: Collection 1: Choose a menu option: 4 Sort books in ascending or descending order of ISBN: ascending Gemini C++ Primer Jack in the box Collection 2: Facial Recognition Time Nature Collection 3: Genetic Entropy 9123055800 9123055820 9123064100 9123055810 9123055830 9123065100 *****: *********: 9123066100 **********Main Menu***** ******* 1. Add books to the library 2. Print available books in the library 3. Create book collections 4. Sort books in the collections 5. Delete a collection 6. Quit ****** ****** ************* Choose a menu option: 5 Which collection would you like to delete? 8 Invalid entry *******************Main Menu**************** 1. Add books to the library ******** 2. Print available books in the library 3. Create book collections 4. Sort books in the collections 5. Delete a collection 6. Quit ********** Choose a menu option: 5 Which collection would you like to delete? 2 Current book collections: Collection 1: Gemini C++ Primer Jack in the box Collection 2: Genetic Entropy 9123055800 9123055820 9123064100 ********** ******Main Menu*** 1. Add books to the library 2. Print available books in the library 3. Create book collections 4. Sort books in the collections 5. Delete a collection 6. Quit ****** ********** 912306610 Choose a menu option: 2 Books available in the library: Facial Recognition 9123055810 Time 9123055830 Nature 9123065100 ********** 6. Quit 1. Add books to the library *** ********Main Menu******** 4. Sort books in the collections 5. Delete a collection ******** 2. Print available books in the library 3. Create book collections Choose a menu option: 6 End **** ******** ******** ********
Function name
print_menu()
check_ISBN()
add_books ()
print_books()
create_collections()
sort_collections()
delete_collection()
main()
Function description
Prints the menu of options to the
librarian
Checks the format of an ISBN
Adds unique books to the library
Prints available books in the library
Creates book collections
Prints sorted books in each
collection
Deletes a collection from the list of
collections and adds it back to the
library
Driver function that calls all the
functions above.
Function input(s)
None
ISBN string
Sequence of books Sequence of
books
Sequence of books
Sequence of books
Function
output(s)/
return value(s)
Menu of options
Sequence of books Sequence of
books
Sequence of books
boolean True or
False
None
Sorted
sequence of
books
Transcribed Image Text:Function name print_menu() check_ISBN() add_books () print_books() create_collections() sort_collections() delete_collection() main() Function description Prints the menu of options to the librarian Checks the format of an ISBN Adds unique books to the library Prints available books in the library Creates book collections Prints sorted books in each collection Deletes a collection from the list of collections and adds it back to the library Driver function that calls all the functions above. Function input(s) None ISBN string Sequence of books Sequence of books Sequence of books Sequence of books Function output(s)/ return value(s) Menu of options Sequence of books Sequence of books Sequence of books boolean True or False None Sorted sequence of books
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY