I'm a beginner and i have been trying to get employee leave management data from user input of 'n' employees using class function.
Here are my codes to get n inputs from user for employee leave management
class Employee:
n=int(raw_input("Pls enter the number of employees:"))
def __init__(self, name, idno, leavetaken, leavereqd, reason):
self.name=name
self.idno=idno
self.leavetaken=leavetaken
self.leavereqd=leavereqd
self.reason=reason
def Employee(self):
print("name:", self.name,", idno:", self.idno, ", leavetaken:", self.leavetaken,", leavereqd:", self.leavereqd,", reason:", self.reason)
print "Employee.name:", Employee.name
print "Employee.idno:", Employee.idno
print "Employee.leavetaken:", Employee.leavetaken
print "Employee.leavereqd:", Employee.leavereqd
print "Employee.reason:", Employee.reason
__name__just because it's built-in function which return class name in your case__idno__(noridno, for the matter). It has attributeIdno. Same with the other four attributes. As a side note, you attempt to print the name and other attributes of the functionEmployee, and it does not have any of them aside from__name__, but it is not the name you think it is.