Build a Book Initialization System

Medium Object Lifecycle & Constructors PRO
🔒 Login to Unlock

Problem Statement

Create a `Book` class taking `title`, `author`, and `pages`. If `pages` is less than 1, set it to 100 in `__init__`. Add a `display()` method to print details with precise spacing.

Input Format

Three lines: Title, Author, and Pages (integer).

Output Format

Print exact multi-line details using tokens.

Constraints

None

Sample Input

Python Basics
John Doe
-5

Sample Output

Title:  Python Basics
Author: John Doe
Pages:  100

Explanation

Combines state validation and formatting into a cohesive class lifecycle.

Starter Code

class Book:
    # Write __init__ and display methods
    pass

if __name__ == '__main__':
    t = input().strip()
    a = input().strip()
    p = int(input().strip())
    # Instantiate and call display
    pass

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used