Question: ( Python problem ) 9 . 2 . 2 Classes: Grouping data Create an instance of the BookInfo class called new _ book. Then, assign

(Python problem)9.2.2 Classes: Grouping data
Create an instance of the BookInfo class called new_book. Then, assign new_book's attributes num_pages and year_published
with the two values read from input, respectively.
Click here for example
Ex: If the input is:
133
2016
then the output is:
Book info: 133 pages, published in 2016
class BookInfo:
def (self):
self.num_pages =0
self.year_published =0
pages_in = int(input())
published_in = int(input())
''' Your code goes here '''
print('Book info: ', end='')
print(f'{new_book.num_pages} pages,', end='')
print(f'published in {new_book.year_published}')
 (Python problem)9.2.2 Classes: Grouping data Create an instance of the BookInfo

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!