Build an Order System with Dataclasses and Enums

Hard Modern Python OOP Features PRO
🔒 Login to Unlock

Problem Statement

Combine modern features! Create an `OrderStatus` Enum (`NEW=1`, `SHIPPED=2`). Create an `Order` dataclass with `id` (int), `amount` (float), and `status` (`OrderStatus`). Read `id`, `amount`, and `status_val`, instantiate the Order, and print them on separate lines.

Input Format

Three space-separated values: ID (int), Amount (float), Status (int).

Output Format

Print three lines with the labels 'Order:', 'Amount:', and 'Status:'.

Constraints

Assume valid enum values.

Sample Input

101 250.5 1

Sample Output

Order: 101
Amount: 250.5
Status: NEW

Explanation

Integrating Enums with Dataclasses provides extremely clean, safe, and readable object modeling.

Starter Code

from dataclasses import dataclass
from enum import Enum

# Define Enum and Dataclass here

if __name__ == '__main__':
    oid, amt, st = input().split()
    # Instantiate and print the properties
    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