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
Using functions,
ZanzabumX [31]

Answer:

See explaination

Explanation:

#include <iostream>

using namespace std;

int main()

{

double h, w;

int s, a, b;

cout<<"height in feet: ";

cin>>h;

cout<<"width in feet: " ;

cin>>w;

cout<<"tile size in inches:";

cin>>s;

int height = h*12;

if(height%s==0)

a = height/s;

else

a = height/s + 1;

int width = w*12;

if(width%s==0)

b = width/s;

else

b = width/s + 1;

cout<<"Number of tiles: "<<a*b;

}

8 0
3 years ago
If you used the VLookup function, where would it look for a value?
zheka24 [161]

Answer:

rowwww potapot FG fhvnhtbrhabeynrynrynebeynye eynry eyney eyney e ye enegbe

4 0
3 years ago
Read 2 more answers
I am trying to go into my outlooks, email but it says. :-( Something went wrong You're currently signed in as ||my hotmail|| . P
Ksju [112]

Answer:

ok???

Explanation:

4 0
3 years ago
What is the speedup of going from a 1-issue processor to a 2-issue processor? use your code from part a for both 1-issue and 2-i
Lyrx [107]
I think it is sped up by around 0.6 GHz
4 0
4 years ago
Subjects with a lot of ___ make focusing easier.
Elden [556K]

Answer:

things is the correct answer

5 0
3 years ago
Read 2 more answers
Other questions:
  • Categorize the following relationships into generalization, aggregation, or association. Beware, there may be n-ary associations
    14·1 answer
  • You discover memory is corrupted, what would be an indication of a software vs. a hardware issue?
    5·1 answer
  • Point mode allows you to select cells for use in a formula by using your finger or the pointer
    7·1 answer
  • What is the command to use the memory diagnostics tool?
    11·1 answer
  • How do you change between worksheets inside an excel workbook?
    13·2 answers
  • 1. Which of the following is not related to a buffer overflow? A. Static buffer overflow B. Index error C. Canonicalization erro
    10·1 answer
  • What is data? why is it important to collect data ? explain the points.​
    10·1 answer
  • Consider this binary search tree:______.
    12·1 answer
  • Explain different types of networking-based attacks
    5·1 answer
  • PLEASE HELP How have phones made us spoiled? How have phones made us unhappy?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!