Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 class Person (object): def init _(self, name, age, gender): Construct a person object given their name, age and gender Using Classes This problem relates
1 class Person (object): def init _(self, name, age, gender): "Construct a person object given their name, age and gender Using Classes This problem relates to the pre-loaded class Person. Using the Person class, write a function print friend info(person) which Paraneters: name (str) The name of the person age(int): The age of the person gender (str): Either 'M or P for male or female 10 accepts a single argument, of type Person, and 12 13 14 15 16 17 18 19 20 21 self. name- name self._ageage self._gender-gender self. friendNone prints out their name prints out their age if the person has any friends, prints 'Friends with (name) Write a function create fry( which returns a Person instance representing Fry. Fry is 25 and his full name is 'Philip J. Fry def eq_(self, person): return str (self) str (person) def str (self): Write a function make_friends (person_one, person_two) which sets each argument as the friend of the other if self._gender M': elif self-gender =- 'F': else: titleMr' title Miss" titleMs 23 24 25 26 27 28 29 30 31 32 return title+self._name +'+str (self._age) def -repr-(self): return Person: str (self) def get name (self): 34 35 (str) Return the name
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started