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. - Define the special method
__str__in thePersonclass to customize how a person is displayed as text:Hello! My name isfollowed by the name. - In the main program, ask the user for three names and store them in a list of
Personobjects. - Display each person on the screen (
printuses the__str__method).
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