Define the method `inc_num_kids()` for the `PersonInfo` class. The `inc_num_kids` method should increment 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
```

```python
class PersonInfo:
def __init__(self):
self.num_kids = 0

# FIXME: Write inc_num_kids(self)
def inc_num_kids(self):
self.num_kids += 1

# Test the class
person1 = PersonInfo()
print('Kids:', person1.num_kids) # Output should be: Kids: 0
person1.inc_num_kids()
print('New baby, kids now:', person1.num_kids) # Output should be: New baby, kids now: 1
```

Answer :

method object of 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 can be write as follows:

Program:

#define class.

class PersonInfo:

def __init__(self): #constructor

self.num_kids = 0

def inc_num_kids(self): #define function inc_num_kids()

self.num_kids = self.num_kids + 1

return self.num_kids #return value.

p= PersonInfo() # creating object

print('Kids:', p.num_kids) #print value

p.inc_num_kids() #call function

print('New baby, kids now:', p.num_kids) #print value

Output:

Kids: 0

New baby, kids now: 1

The program begins by defining the PersonInfo class. This class defines a constructor that def __init__() and a function that def inc_num_kids().

The constructor is called automatically when the class object is created. This constructor takes self as a parameter that is used to access variables belonging to the class.

In the constructor, define a variable 'num_kids'. Assign a value to a variable that is '0' and use self to keep a reference to the variable.

Then define the function. This function increments the value of the variable by 1 and returns the value.

Then create a class object that is p, call the function, and print its value.

learn more about method object at https://brainly.com/question/13928668

#SPJ4