Python Practice › OOP Programs › Program 38

Employee class

EasyOOP Programs · 38 of 48

Create Employee with name and salary and a method to print them.

Advertisement
Output
Asha: Rs 650,000

Approach

  1. Store and print.

Solution

Python
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.

More oop programs

← All 48 OOP Programs

Leave a Comment