text: I an new to programming, I progressed to oop in python using different books but when I get to oop things go very wrong. then I went on-line but but I still get errors when I run an example code which ran perfectly on their system. For example this code I found on tutorialspoint:
  class Employee:
  'common base class for all employees'
  empCount=0
  def displayCount(self):
  print "Total employee %d"%Employee.empCount
  def displayEmployee(self):
  print "Name:",self.name,'salary:',self.salary
  emp1= Employee()
  emp2= Employee()
  emp1.displayEmployee()
  emp2.displayEmployee()
  print "Total employee(s)%d"%employee.empCount
  when they ran it it printed on the screen this:
  Name : Zara ,Salary: 2000
  Name : Manni ,Salary: 5000
  Total Employee 2
  but if I run the same code I get this:
  >>>
  Name:
  Traceback (most recent call last):
  File "J:\employee.py", line 20, in <module>
  emp1.displayEmployee()
  File "J:\employee.py", line 14, in displayEmployee
  print "Name:",self.name,'salary:',self.salary
  AttributeError: Employee instance has no attribute 'name'
  this same error is produced any time I run any python code on oop
  I mean is OOP not for everyone?
  because I am sick and tired of this rubbish