Creating library object.
I have a library.txt that contain 20 books and every line in library,txt contain author ,title and loan , my questions is how to create class and object for library script with python.
1. search at title
2. search at author
3. Borrow a book
4. Return a book.
5. Adds a new book.
6. Removes a book.
For example when someone borrowed a book we get ”The book is borrowed”
I shall be very grateful for your help.
class Library: def __init__(self, author, title): self.author = author self.title = title self.borrowed = False def search_title: def search_author: def borrow_book: def Return_book: def add_book: def remove_book: -------- Main Program -------- print("Welcome to the library!")
Edited 4 Years Ago by tony75