Question: CHALLENGE 9.3.1: Creating a method object. ACTIVITY Define the method object inc_num_kids() for PersonInfo. inc_num_kids increments the member data num_kids. Sample output for the

CHALLENGE 9.3.1: Creating a method object. ACTIVITY Define the method object inc_num_kids() for PersonInfo. inc_num_kids increments the member data num_kids. Sample output for the given program with one call to inc_num_kids(): Kids: 0 New baby, kids now: 1 1 class PersonInfo: 2 3 4 5 6 7 def _init__(self): self.num kids 0 # FIXME: Write inc_num_kids (self) "Your solution goes here *** 8 9 person1 PersonInfo() 10 11 print('Kids:', person1.num_kids) 12 person1.inc_num_kids() 13 print('New baby, kids now:', person1.num_kids) 1 test passed All tests passed
Step by Step Solution
3.40 Rating (147 Votes )
There are 3 Steps involved in it
Python version 36 Python program to create a method incnumkids w... View full answer
Get step-by-step solutions from verified subject matter experts
