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
Yuki888 [10]
3 years ago
13

Can somoene explain the function of-def __init__():In python programming language​

Computers and Technology
1 answer:
JulsSmile [24]3 years ago
8 0

Answer:

def is a keyword used to define a function, placed before a function name provided by the user to create a user-defined function

__init__ is one of the reserved methods in Python. In object oriented programming, it is known as a constructor. Python will call the __init__() method automatically when you create a new object of a class, you can use the __init__() method to initialize the object’s attributes.

Example code:

class Person:

 def __init__(self, name, age):

   self.name = name

   self.age = age

p1 = Person("John", 36)

print(p1.name)

print(p1.age)

Summary

  • Use the __init__() method to initialize the instance attributes of an object.
  • The __init__() doesn’t create an object but is automatically called after the object is created.
You might be interested in
____ contain instructions for the OS for hardware devices, such as the keyboard, mouse, and video card, and are stored in the sy
AnnyKZ [126]

The Motherboard contains instructions for the OS for hardware devices, such as the keyboard, mouse, and video card, and are stored in the systemroot\Windows\System32\Drivers folder.

Learned this in middle school, your welcome ;)

3 0
3 years ago
What is a mortgage?
wel
D is the answer. Have a good day!
8 0
3 years ago
Read 2 more answers
Arrange the steps in a sequence that you would follow while sorting data in a spreadsheet.
ss7ja [257]

Answer:

  1. In the spreadsheet menu, click the Data option.
  2. Select the column to sort.
  3. In the submenu of Data, click the Sort… option.
  4. In the Sort dialog box, click the “ascending” option for the  first sort criteria.
  5. Click OK.

Explanation:

The correct sequence is as shown above.

3 0
3 years ago
Define an object named outfile that can be used to write data from program variables to a file.
Sedbober [7]
Frist, we define the variable outfile by this line:
ofstream outfile;
Since the variable is to be used to write data from program variables, we don't assign it any type of variable for it to be a general variable for different values<span />
6 0
3 years ago
You can restore a deleted layer during the current editing session by deleting the _____ state on the history panel.
bulgar [2K]
You can restore a deleted layer during the current editing session by deleting the Delete Layer <span>state on the History palette.</span>
7 0
3 years ago
Other questions:
  • _____________ is a service that provides access to hardware resources available over the Internet.
    11·1 answer
  • How do computers perform complicated tasks built from simple instructions?
    14·1 answer
  • What is the main idea of this article? Please someone help me. I will give brainliest answer
    7·1 answer
  • Which of the following should you always wear to avoid being thrown from a vehicle and then crushed if it tips over?
    12·2 answers
  • In order to make burger a chef needs the following ingredients one piece of chicken meat 3 lettuce leaves 6 tomato slices Write
    8·1 answer
  • A URL suffix is called a domain name.
    11·1 answer
  • Let’s say you’re publishing a message with the Hootsuite Composer. The message contains a link to a landing page, and you want t
    9·1 answer
  • Given an initialized String variable outfile, write a statement that declares a PrintWriter reference variable named output and
    12·1 answer
  • In this class, it is very common for your computer screen to look like this. What is this?​
    5·1 answer
  • Class.object.method is an example of using the ______<br> to access the elements of a class.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!