#18 - Property Methods
By Ifeanyi Omeata

Hi, I am a Software Developer of 3-4 years specialising in React, Javascript, Node, NextJS, Express, Python, Django, Fast API, SQL and a few other technology stack, with a good background in Networking and Cloud Infrastructure. I am working to become a DevOps Solutions Engineer and happily married to my long time girlfriend.
Topics:
1. Property Methods
1. Property Methods
>>Return to Menu
class Employee():
raise_amt = 1.04
def __init__(self, first, last):
self.first = first
self.last = last
@property
def email(self):
return '{}.{}@gmail.com'.format(self.first.lower(), self.last.lower())
@property
def fullname(self):
return '{} {}'.format(self.first, self.last)
@fullname.setter
def fullname(self, value):
first,last = value.split(' ')
self.first = first
self.last = last
@fullname.deleter
def fullname(self):
print(f'Deleted {self.fullname}')
self.first = None
self.last = None
emp1 = Employee('Mike','Smith')
emp1.fullname = 'Ada Curry'
#del emp1.fullname
print(emp1.first)
print(emp1.email)
print(emp1.fullname)
#End
Hope you enjoyed this! :) Follow me for more contents...
Get in Touch:
www.ifeanyiomeata.com
contact@ifeanyiomeata.com
Youtube: https://www.youtube.com/c/IfeanyiOmeata
Linkedin: https://www.linkedin.com/in/omeatai/
Twitter: https://twitter.com/iomeata
Github: https://github.com/omeatai/
Stackoverflow: https://stackoverflow.com/users/2689166/omeatai
Hashnode: https://hashnode.com/@omeatai
Medium: https://medium.com/@omeatai
© 2022






