Simple creation
Input
User('Alice', 30).age
Output
30
Constructing a User with a valid age returns that age from the age property.
Full lesson preview
Learn to enforce constraints using a property setter that validates assignments and raises ValueError for invalid data.
Problem statement
Task
Examples
Input
User('Alice', 30).age
Output
30
Constructing a User with a valid age returns that age from the age property.
Input format
Output format
Constraints
Samples
Input
User('Bob', 25).age
Output
25
25 is within the allowed range and is an integer.