Question: Problem Statement: Create a Python class that represents an individual with the following attributes: - ( quad ) a string representing the
Problem Statement:
Create a Python class
that represents an individual with the following attributes:
quad a string representing the person's first name
a string representing the person's last name
: an integer representing the person's age
Requirements:
Create a file that contains the Person class.
The Person class should have a constructor initializer that takes and age as arguments and sets the corresponding attribute values.
The class should have a method that determines if the current instance is a minor ie under the age of
Example:
If you create an instance of with "John", lastname "Doe", and age the method should return because John is not a minor. You may use the below code in another Python file mainpy for example to test your class file:
## Test Code
from person import Person
peoplelist PersonRobert 'Johnson',
PersonBob 'Robby',
PersonJohn 'Smith',
for x in peoplelist:
agedesc 'Adult'
if xisMinor: agedesc 'Minor'
printfxfirstnamexlastname is a agedesc
Hint:
Think about how you can define a method that takes the age attribute into account to determine if a person is a minor. You may want to use a simple comparison operator to achieve this.
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
