Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions

Question

l Summarize the process of evaluating HR performance.

Answered: 1 week ago

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago