-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram3.py
More file actions
33 lines (22 loc) · 705 Bytes
/
Program3.py
File metadata and controls
33 lines (22 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Program to implement a book class and bookstore
class BookStore:
def __init__(self, books):
self.books = books
def getbooks(self):
return self.books
class Book:
def __init__(self, name, isbn, author):
self.name = name
self.isbn = isbn
self.author = author
bookList = [Book("Book1", "122323-ww-ww", "David"),
Book("Book2", "323332-rr-ee-ee32", "Ben"),
Book("Book3", "223-ew-ee-e", "Paul"),
Book("Book4", "yy-21-12y", "Adam")]
bookstore = BookStore(bookList)
for item in bookstore.getbooks():
print("==========")
print(item.name)
print(item.isbn)
print(item.author)
print("==========")