Assignment 1 (1)
Assignment 1 (1)
Instructions:
This assignment will test your understanding of multiple Python programming concepts
combined into a single cohesive application. Write a program to solve the problem
below. Include detailed comments explaining each step and your logic.
Problem Statement
You are tasked with creating a "Library Management System" to help a librarian track
and manage books.
Functional Requirements:
1. Book Records
§ title (string)
§ author (string)
§ year (integer)
§ copies_available (integer)
o Add a Book:
§ Take the title, author, year, and number of copies from the user.
§ Ensure that titles are unique. If a title already exists, update the
number of available copies instead.
§ Display the details of the book if found (use string formatting for
neat output).
§ If the book isn’t found, display “The book was not found”.
o Borrow a Book:
o Return a Book:
§ Example:
------------------------------------------------
o Exit:
3. Validation
o Ensure inputs are valid (e.g., year must be a positive integer, copies must
be non-negative).
o If invalid input is detected, prompt the user again until correct data is
entered.
4. Additional Functionalities
o Use repetition structures (loops) for the menu and to re-prompt the user
for invalid inputs.