How to create and call Method of a Class in Python?
Methods in classes are functions that belong to the class.
class Employee: salary = 10000 name = "John Doe" def tax(self): print(self.salary * 0.10) emp1 = Employee() print(emp1.salary) print(emp1.name) emp1.tax()
Sample output of above program.
10000 John Doe 1000.0
2019-06-23T08:54:54+05:30
2019-06-23T08:54:54+05:30
Amit Arora
Amit Arora
Python Programming Tutorial
Python
Practical Solution