class Employee:
def displayEmployee(self):
a=120
print a
emp1 = Employee()
print (emp1.displayEmployee())
i am also getting 120 None
i want to remove none from my output
class Employee:
def displayEmployee(self):
a=120
print a
emp1 = Employee()
print (emp1.displayEmployee())
i am also getting 120 None
i want to remove none from my output
Your code is not formatted, but the error tells you that you have a wrong indentation. Your code should be:
class Employee:
def displayEmployee(self):
a=120
print a
emp1 = Employee()
print (emp1.displayEmployee())
This will get you rid of the IndentationError
, and presumably do what you want. However, the last line should be:
emp1.displayEmployee()
instead of print(...)
, because the displayEmployee
method prints itself something, and does not return anything to print.