Which function is ran when an object is instantiated?

The function is called init. This is the constructor, which is used to initiate the attributes of the object and allows arguments to be passed upon instantiation.

KC

Related Python Mentoring answers

All answers ▸

Which four data types are used in Python? Can you give an example of each?


Create a program that generates prime numbers between two integer boundareis


Demonstrate a recursive solution to calculate the factorial of a number


Explain why creating a list of several instances of one element using something like my_list = [a] * 5 can result in strange behaviour