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
Answered by Kelvin C. Python tutor

1395 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

Write a recursive function to find the factorial of a number n.


How do you define a class in python


Write a python function that takes a string as parameter and returns the character in the string with the most occurrences, along with the number of times this character occurs


How do you write code to implement a recursive fibonacci algorithm?


We're here to help

contact us iconContact ustelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo

© MyTutorWeb Ltd 2013–2025

Terms & Conditions|Privacy Policy
Cookie Preferences