Editor settings

General settings

Save settings

Learn to program with Python

Create a person #

Create a Person class to have properties and methods satisfying all the tests.


Tests #

  • A Person object is created with the code person = Person("samson craig", 30, "male", "software engineer")
    • person.first_name should be "Samson". Make sure the case is right.
    • person.last_name should be "Craig". Make sure the case is right.
    • person.age should be 30
    • person.occupation should be "software engineer"
    • person.introduce() should print the message "Hello, my name is Samson. I am 30 years old. I am a male working as a software engineer."
    • person.celebrate_birthday() should increase the age property by 1
    • person.introduce() should print the message "Hello, my name is Samson. I am 31 years old. I am a male working as a software engineer." after person.celebrate_birthday()
    • person.change_job("data analyst") should set the occupation property to "data analyst"
    • person.introduce() should print the message "Hello, my name is Samson. I am 31 years old. I am a male working as a data analyst." after person.celebrate_birthday()
Output will be displayed here