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
I need help pleaseeee
MrRissso [65]

Answer:

Explanation:

I  ....

6 0
3 years ago
Why is it good to be a computer programmer?​
liubo4ka [24]

Answer:

It's your wish become other professions like doctor, engineer are also good. But in this profession you can make apps, websites and can do hacking. Which is are cool things to do. But every profession is best at it's profession.

Explanation:

If you like my answer than please mark me brainliest

5 0
2 years ago
Complete data are very rare because some data are usually missing. There are typically four strategies to handle missing data.
netineya [11]

Answer:

see explaination

Explanation:

If I am to select I will select the strategy Impute the missing values . Because rather than deleting and all the other strategies. This is the best option because, this is an optional field as described there is no need for such accurate information about salary.

If we want to maintain this field we can just fill the value by identifying the similar records which is the other customers who is visiting the same no of times and fill that.

5 0
3 years ago
Kelly is a college sophomore majoring in computer science. She is interested in gaining exposure to the most useful and current
Nonamiya [84]

Answer:

The correct answer for the given question is an option(b) i.e java.

Explanation:

Java is an object oriented programming language that is mostly used for the creating the websites.Java is most secure and reliable programming language than the other programming language.

C is a programming language but it is not object oriented programming language thats why this option is incorrect.

Visual basic is a Programming language it is also used to create a web page but it is not commonly used to create a web page  thats why this option is incorrect.

The scheme is not used to create a web page  thats why this option is also incorrect.

7 0
3 years ago
Which of the following devices can be connected to a network? Check all of the boxes that apply.
Diano4ka-milaya [45]

Answer:

1, 2, 4, 6

Explanation:

5 0
3 years ago
Other questions:
  • Which Game Is Better & Favorite For You?
    12·2 answers
  • Which button is used to open the Start menu in Windows Vista?
    14·1 answer
  • Which career involves analyzing various factors that influence the customer decision-making process?
    13·1 answer
  • A telecom company wants to extend their horizontal cables over a distance of 510 meters. Which cable should they use?
    6·1 answer
  • Write a recursive function that returns true if the digits of a positive integer are in increasing order; otherwise, the functio
    15·1 answer
  • The Department Manager researches new data platforms for the company and requests a list of essential features. Which essential
    6·1 answer
  • OI MINHA PRIMEIRA VEZ AQUI
    7·1 answer
  • Write the functions of F1 to F12 on the keyboard​
    5·2 answers
  • When writing a function or a formula in a spreadsheet,what is the first u should do​
    5·1 answer
  • Design a circuit that will tell whether a given month has 30 days in it.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!