Object-oriented programming · 15 / 26 Exercise Medium

Photo book class

Objective

Develop a Python program to manage a photo album using object-oriented programming.

Instructions

  • Create a class called PhotoAlbum with a private attribute num_pages (integer) and a public method get_number_of_pages() that returns the number of pages.
  • The constructor creates an album with 16 pages by default, and it accepts an optional parameter to specify the number of pages.
  • Create a class called SuperPhotoAlbum, which inherits from PhotoAlbum, whose constructor creates an album with 64 pages.
  • Create a class AlbumTest that creates a default album, an album with 24 pages and a large album, and displays the number of pages of each one.
Output
16
24
64

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise