I wrote a simple program but it shows me an error:
#the program:
# Python classes
class Employee:
raise_amount=1. 04
def __int__(self, first, last, pay):
self.__first = first
self.__last= last
self.__pay= pay
self.__email= first+ "." + last + "@company.c om"
def fullname(self):
return '{} {}'.format(self .first, self.last)
def apply_raise(sel f):
self.pay = int(self.pay * self.raise_amou nt)
a= Employee('Pawan ' , 'Neu' , '555')
b= Employee('Sonu' , 'Khatri' , '666')
print (a.__dict__)
print(a.fullnam e())
print(Employee. raise_amount)
#the error is as follows:
Traceback (most recent call last):
File "C:\Users\user\ Desktop\practic e.py", line 19, in <module>
a= Employee('Pawan ' , 'Neu' , '555')
TypeError: this constructor takes no arguments
#the program:
# Python classes
class Employee:
raise_amount=1. 04
def __int__(self, first, last, pay):
self.__first = first
self.__last= last
self.__pay= pay
self.__email= first+ "." + last + "@company.c om"
def fullname(self):
return '{} {}'.format(self .first, self.last)
def apply_raise(sel f):
self.pay = int(self.pay * self.raise_amou nt)
a= Employee('Pawan ' , 'Neu' , '555')
b= Employee('Sonu' , 'Khatri' , '666')
print (a.__dict__)
print(a.fullnam e())
print(Employee. raise_amount)
#the error is as follows:
Traceback (most recent call last):
File "C:\Users\user\ Desktop\practic e.py", line 19, in <module>
a= Employee('Pawan ' , 'Neu' , '555')
TypeError: this constructor takes no arguments
Comment