Skip to content
C

Problem 1: Simple Book Class

Easypython

Problem Description

Create a class Book with attributes title, author, and pages. Add a method display_info() that prints all three details in a readable format.

Input

A book's title, author, and number of pages.

Output

A formatted display of the book's details.

Constraints

  • pages must be a positive integer.

Example Input

text
title = "Python for Beginners", author = "A. Sharma", pages = 250

Example Output

text
Title: Python for Beginners Author: A. Sharma Pages: 250

Concepts Covered

Class definition, __init__, attributes, methods.

Input (stdin)

Output

Run your code to see output here...