The field() Function for advanced configuration

Medium Modern Python OOP Features
Solve in Playground →

Problem Statement

Create an `Item` dataclass with `name` (string) and `secret_code` (string). Use the `field()` function to exclude `secret_code` from the `__repr__` output (`repr=False`). Print the instantiated object.

Input Format

Two space-separated strings.

Output Format

Print the object representation.

Constraints

None

Sample Input

Apple 12345

Sample Output

Item(name='Apple')

Explanation

The `field()` function allows granular control over how individual attributes behave in generated methods like `__repr__` and `__init__`.

Starter Code

from dataclasses import dataclass, field

# Define the Item dataclass here using field()

if __name__ == '__main__':
    n, c = input().split()
    # Instantiate and print
    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