Monday, November 7, 2016

python class day1

class Employee:

def __init__(self,first,last,pay):
self.first = first
self.last = last
self.pay = pay
self.email = first + '.' + last + "@company.com"

def fullname(self):
return('{} {}'.format(self.first, self.last))
emp_1 = Employee('Corey', 'Schafer' , 50000)
emp_2 = Employee('Test', 'User', 60000)


'''print(emp_1)
print(emp_2)

emp_1.first = "corey"
emp_1.email = "Test.User@gmail.com"

emp_2.first = "anderson"
emp_2.email = "nderson@gmail.com"'''

print(emp_1.email)
print(emp_2.email)
#print(emp_1.fullname())
print(Employee.fullname(emp_1))


output:
Corey.Schafer@company.com
Test.User@company.com
Corey Schafer
=> None