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 ▸

Creating string from multiple strings(or characters)


What are docstrings and how do I use them to improve my code readability?


Manually implement a function that finds the smallest value in a list of integers and print it.


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