1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Rama09 [41]
3 years ago
6

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
Computers and Technology
1 answer:
CaHeK987 [17]3 years ago
7 0

Answer:

The answer to this question can be given as:

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

Explanation:

The description of the above python program as follows:

  • In this program firstly we define the class that is PersonInfo. In this class we define the constructor that is def __init__() and one function that is  def inc_num_kids().
  • The constructor is called automatically when the class object is created. In this constructor, we use the self as a parameter that is used to access variables that belong to class.
  • In the constructor, we define the variable that is "num_kids". We assign value to a variable that is "0" and use the self for holding reference to the variable.
  • Then we define the function. In this function, we increment the value of the variable by 1 and return its value.
  • Then we create a class object that is p and call the function and print its value.  

You might be interested in
Henry Ford would have been most interested to bring which modern innovation to his automotive factories?
kondor19780726 [428]
Henry Ford would have been most interested to bring assembly lines which is an modern innovation to his autmotive factories. Although Henry Ford didn't invent cars he developed assembly lines
3 0
3 years ago
Read 2 more answers
Which of these browsers was the first widely adopted?
coldgirl [10]

Answer:

netscape

Explanation:

5 0
3 years ago
Greg is the network administrator for a large stadium that hosts many events throughout the course of the year. They equip usher
Sav [38]

Answer:

Device Authentication

Explanation:

Device authentication allows the venue to restrict network access to authorized scanners but does not require individual ushers to sign in to the device. This seems an acceptable level of security for this environment, as the scanners are carefully controlled. Moving to any authentication scheme that requires user authentication would be unwieldy

6 0
3 years ago
Which type of computer graphic can be blown up to a much larger size without getting distorted or losing quality?
Daniel [21]
The answer is a. A Vector Graphic

Vector graphic uses polygones that represented by mathematical equations or proper tags that make it very coordination oriented and allow infinite enlargement without losing any quality

the most popular vector graphic format that being used today is SVG
5 0
3 years ago
what is a massive online storage that allows for Access by any internet-connected device running web browser. use for Less priva
Paladinen [302]
I recommend Google Drive, it allows up to 15gb of free storage. You can access it anywhere since it is fromGoogle. Another one you can try is Dropbox which only allows up to 2gb.
8 0
3 years ago
Other questions:
  • List THREE different types of mouse:​
    9·2 answers
  • Consider a channel that can lose packets but has a maximum delay that is known. Modify Protocol rdt2.1 to include sender timeout
    11·1 answer
  • Which of the following JavaScript expressions is equivalent to the given HTML code? ​ a. Document.getelementbyId("menu1").menu=
    6·1 answer
  • This exercise shows why each pivot (in eli1nination by pivoting) must be in a different row. (a) In Example 7, make the third pi
    15·1 answer
  • 22
    15·1 answer
  • PLZ HELP! ANSWER (WITH CORRECT ANSWER AND EXPLANATION THAT ACTUALLY IS CORRECT) GETS BRAINLIEST!
    13·1 answer
  • When machining rotors, what is the reason for setting the indexing collars to zero?
    9·1 answer
  • One problem with _______ is that often many copies of the same document are made. <br><br>HELPPP ​
    11·1 answer
  • Mention the usage of crop concept in ms-word​
    13·2 answers
  • The startup routine runs,when machine boots up is known as​
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!