Build a Secure UserProfile Class

Hard Encapsulation & Data Hiding PRO
🔒 Login to Unlock

Problem Statement

Create a `UserProfile` class. Attempt to set a `password` using a setter. If the length is < 8, print 'Invalid'. The getter should always return '***' to mask it. Print 'Pass: [val]'.

Input Format

A single string for the password.

Output Format

If invalid, print 'Invalid' then a newline. Then print 'Pass: ***'.

Constraints

None

Sample Input

short

Sample Output

Invalid
Pass: ***

Explanation

Combines privacy mangling, validation on the setter, and data masking on the getter to form a fully encapsulated module.

Starter Code

class UserProfile:
    def __init__(self):
        self.__password = ''
    # Add property and setter logic for password

if __name__ == '__main__':
    pwd = input().strip()
    # Instantiate, set password, and print masked result
    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