Verify the Age
Your task is to create a simple personnel management system using Python. The system should be capable of handling a
Person
class. A Person
is characterized by a name and age.A
Person
can introduce themselves by stating: "My name is <name>
and I am <age>
years old.".However, the system should be able to validate the ages of the people. If the age is not a positive integer or if the age is more than 130 (since that's more than the verified oldest person ever), an
AgeError
should be thrown.Input | Output |
alice=Person('Alice', 25); alice.introduce_yourself(); | My name is Alice and I am 25 years old. |
charlie=Person('Charlie', -1); charlie.introduce_yourself(); | AgeError: Invalid age provided. |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB