@Kapil3sh/

Classes and Instances

Python 2.7

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class Employee:

  def __init__(self,first,last,pay) : 
    self.first = first
    self.last = last
    self.pay = pay
    self.email = first +"."+last+"@companyname.com"
  
  def display_full (self):
    return '{} {}'.format(self.first,self.last)

emp1 = Employee('kapilesh','kothavale', 50000)
emp2 = Employee('test','user', 60000)
print(emp1.email)
print(emp2.email)

print(emp2.display_full())
print(Employee.display_full(emp1))