Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Book:
- def __init__(self, title, author, price, chapters):
- self.title = title
- self.author = author
- self.price = float(price)
- self.chapters = chapters
- books = []
- while True:
- text = input()
- if text == "on work":
- break
- text = text.split(" -> ")
- f_half = text[0].split()
- if len(f_half) > 2:
- books.append(Book(f_half[0], f_half[1], f_half[2], text[1].split(", ")))
- sold_books = []
- while True:
- text = input()
- if text == "end work":
- break
- for book in books:
- if book.title == text:
- sold_books.append(book)
- else:
- print(f"No such book here")
- print(sold_books)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement