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 ▸

What is the outcome of the following code? print(2*[3,4,5])


What are the main data structures that I can use in Python


Using the shared code editor, write a recursive function for calculating a factorial of an input parameter.


Write a function that checks whether a number is prime or not.