Q20Comprehension3 Marks7 Aug 2022
Passage
Based on the above data, answer the given subquestions. Consider a class named Book that has the following attributes:
- year: year of publication
- pages: number of pages
- num_sold: number of copies sold as of 2022
The attribute best_seller will be defined in the subquestions.
```
class Book:
def __init__(self, year, pages, num_sold):
self.year = year
self.pages = pages
self.num_sold = num_sold
self.best_seller = None
```
What is the output of the following snippet of code?
```
books = [Book(1972, 345, 12345), Book(1987, 400, 1234567),
Book(2001, 531, 1000002), Book(2011, 150, 2000000),
Book(2013, 345, 3000214), Book(1943, 501, 5000134)]
count = 0
for book in books:
book.update_status()
if book.best_seller and book.pages <= 500:
count += 1
print(count)
```
Press Enter to check.