Basic usage
Input
c = SecureCounter(3) c.increment() c.value
Output
4
Create a counter starting at 3, increment by 1 (default) and read the value property which returns 4.
Full lesson preview
Learn to keep an object's internal state private using Python's name mangling (double-underscore) and expose a safe public API.
Problem statement
Task
Examples
Input
c = SecureCounter(3) c.increment() c.value
Output
4
Create a counter starting at 3, increment by 1 (default) and read the value property which returns 4.
Input format
Output format
Constraints
Samples
Input
SecureCounter(3).increment()
Output
4
Incrementing a counter starting at 3 by the default 1 returns 4.