OOP Challenge: Final Comprehensive System

Hard Design Patterns & Final Challenges PRO
🔒 Login to Unlock

Problem Statement

Combine the patterns! Build a `Library` class that acts as a Singleton. Implement context managers (`__enter__`, `__exit__`) logging ‘Tx Open’ and ‘Tx Close’. Allow it to store an internal book list and support iteration (`__iter__`). Read a book name, open a context, add the book, and iterate through the library to print.

Input Format

A single string representing a book title.

Output Format

Print transaction logs, then the book title.

Constraints

None

Sample Input

Python101

Sample Output

Tx Open
Tx Close
Book: Python101

Explanation

A complete systems-level architecture blending Singleton, Context Managers, and Iterator protocols into one robust object.

Starter Code

class Library:
    # Combine Singleton, Context Manager, and Iterator logic
    pass

if __name__ == '__main__':
    book_name = input().strip()
    # Orchestrate the library
    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