am a python beginner, receeently started learning about classesand i wrote this got this little code that keeps bringing this error . please i need someone here to help debug it:

class employee():
`   empcount=0`
    def _init_(self,name,salary):
        self.name=name
        self.salary=salary
        employee.empcount=+1
    def displaycount(self):
        print 'Total employee: %d' %employee.empcount
    def displayemployee(self):
        print 'Name:',self.name,'salary:',self.salary
#########################################################
#main program
emp1n=raw_input('enter name of employee1:')
emp2n=raw_input('enter name of employee2:')
emp1s=input('enter salary of employee1:')
emp1n=input('enter salary of employee2:')
emp1=employee(emp1n,emp1s)
emp2=employee(emp2n,emp2s)
emp1.displayemployee()
emp2.displayepmloyee()
print 'total employees:',employee.empcount

double underscore in init
Several typos.

class employee():
    empcount=0
    def __init__(self,name,salary):
        self.name=name
        self.salary=salary
        employee.empcount+=1
    def displaycount(self):
        print 'Total employee: %d' %employee.empcount
    def displayemployee(self):
        print 'Name:',self.name,'salary:',self.salary
#########################################################
#main program
emp1n=raw_input('enter name of employee1:')
emp2n=raw_input('enter name of employee2:')
emp1s=input('enter salary of employee1:')
emp2s=input('enter salary of employee2:')
emp1=employee(emp1n,emp1s)
emp2=employee(emp2n,emp2s)
emp1.displayemployee()
emp2.displayemployee()
print 'total employees:',employee.empcount

thanks for your help, i just got the answer, ill really enjoying this forum

You are welcome.
I would advice you not to write so much code without testing until you are more experienced.
If you have written the class only with the constructor and tested it, much of the problems were clear at the beginning.

class employee():
    def __init__(self,name,salary):
        self.name=name
        self.salary=salary
#########################################################
#main program
emp1=employee('a',10)
emp2=employee('b',20)
print emp1.name, emp2.name
print emp1.salary, emp2.salary

OK..I the major problem was with the underscore ..ill try to run programs in bits next time

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.