+ 3
in lesson magic method on python, examples in my idle gives error please help, it confused me? i cant write codes from there
magic method
3 Answers
+ 3
Try like this:
class Test:
def __init__(self, var1, var2):
self.var1=var1
self.var2=var2
obj=Test(1, 2)
+ 2
__init__ method is used to make variables for each object in this class.
+ 2
ok but each code gives error from these lesson in my idle, scripter i cant find the mistakes