Question: ANSWER: class Book: def __init__(self, title, author, price, stock): self.title = title self author = author self price = price self.stock stock class Bookstore:
ANSWER: class Book: def __init__(self, title, author, price, stock): self.title = title self author = author self price = price self.stock stock class Bookstore: def __init__(self): self.books = [] def add_book(self, book): self.books.append(book) def search_book(self, title): for book in self.books: if book.title == title: return book return None def place_order(self, book, quantity): if book in self books and book.stock >= quantity book.stock -= quantity return f*Order placed: [quantity] copies of '[book.title)" by (book.author]"
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
