Question: Create a new Python script named introduction.py . Within this script, define a class named Person. The class should have the following attributes: name (
Create a new Python script named introduction.py
Within this script, define a class named Person. The class should have the following attributes:
name string
age integer
country string
These attributes should be set during the initialization of a Person object.
Add a method to the Person class named introduceyourself.
This method should print a string in the format: "Hello, my name is name Im age years old and Im from country
Ensure the name, age, and country values in the string come from the object's attributes.
Now, create two Person objects with different attributes ie different names, ages, and countries
For example, you might create one Person object representing a yearold named John from Canada, and another Person object representing a yearold named Maria from Spain.
You could also create a Person object of yourself or a classmate.
Call the introduceyourself method on both Person objects, and observe the output.
Ensure that the printed output matches the attributes of each Person object.
Save your Python script and run it to verify that it works as expected.
The console should print the introduction messages for both Person objects.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
