class Course: def __init__(self, title, thumbnail): self.title = title self.thumbnail = thumbnail self.details_option = "View Details" self.buy_option = "Buy Now" def display_thumbnail(self): print(f"Thumbnail: {self.thumbnail}") def display_options(self): print(f"Options: {self.details_option}, {self.buy_option}") class InsidePage: def __init__(self, course): self.course = course def display_inside_page(self): print(f"Inside Page for {self.course.title}") print(f"Options: {self.course.details_option}, {self.course.buy_option}") # Creating a course instance course = Course("Python Programming", "python_thumbnail.jpg") # Displaying the course thumbnail and options course.display_thumbnail() course.display_options() # Creating an inside page for the course inside_page = InsidePage(course) # Displaying the inside page and its options inside_page.display_inside_page()

Comments

Popular Posts