Python Practice › OOP Programs › Program 38
Employee class
Create Employee with name and salary and a method to print them.
Output
Asha: Rs 650,000
Approach
- Store and print.
Solution
class Employee: def __init__(self, name, salary): self.name, self.salary = name, salary def show(self): print(f"{self.name}: Rs {self.salary:,}") Employee("Asha", 650000).show()Output
Asha: Rs 650,000
Learn the concept
New to this topic? Read the lesson, then come back.