Initialize with in-range value
Input
RangedValue(50, 0, 100).value
Output
50
50 is within 0..100 so it is stored unchanged.
Full lesson preview
Learn to use Python's @property setter to ensure an attribute always stays within a specified range.
Problem statement
Task
Examples
Input
RangedValue(50, 0, 100).value
Output
50
50 is within 0..100 so it is stored unchanged.
Input format
Output format
Constraints
Samples
Input
RangedValue(-10, 0, 100).value
Output
0
Initial value -10 is below the minimum 0, so it's clamped and stored as 0.