Ask Question
24 August, 08:47

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: 0New baby, kids now: 1

+1
Answers (1)
  1. 24 August, 12:04
    0
    class PersonInfo:

    def __init__ (self):

    self. num_kids = 0

    def inc_num_kids (self):

    self. num_kids + = 1

    person1 = PersonInfo ()

    print ('Kids:', person1. num_kids)

    person1. inc_num_kids ()

    print ('New baby, kids now:', person1. num_kids)

    Explanation:

    Line 1 of the code, we define the class PersonInfo. Line 3 of the code is the function that will increment the member data num_kids.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Define the method object inc_num_kids () for PersonInfo. inc_num_kids increments the member data num_kids. Sample output for the given ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers