Accessing Private Variables Externally (The bypass)

Medium Encapsulation & Data Hiding
Solve in Playground →

Problem Statement

Create the same `Account` class with `__balance`. This time, bypass the name mangling by accessing the attribute using its internal python name `_Account__balance`. Print ‘Balance: [val]’.

Input Format

A single integer for balance.

Output Format

Print the balance accessed via the mangled name.

Constraints

None

Sample Input

500

Sample Output

Balance: 500

Explanation

This proves that Python doesn't have true private variables; the interpreter simply changes the attribute's name to prevent accidental access.

Starter Code

class Account:
    # Set private __balance here
    pass

if __name__ == '__main__':
    b = int(input())
    acc = Account(b)
    # Access using name mangling bypass
    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