Objective
Create a Python program that asks the user for three names and stores them in a list of objects of the Person class.
Instructions
- Create a class called
Personwith an attribute calledname. - Implement the constructor
__init__of thePersonclass, which receives the name as a parameter. - Include a "destructor" (
__del__) that sets the name to an empty text. - Define the special method
__str__to display the person as text:Hello! My name isfollowed by the name. - In the main program, ask the user for three names, store them in a list of
Personobjects and display each person on the screen.
Juan
Sara
Carlos
Hello! My name is Juan
Hello! My name is Sara
Hello! My name is Carlos
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise