World's Best AI Learning Platform with profoundly Demanding Certification Programs
Designed by IITians, only for AI Learners.
Designed by IITians, only for AI Learners.
New to InsideAIML? Create an account
Employer? Create an account
Download our e-book of Introduction To Python
4.5 (1,292 Ratings)
559 Learners
Pallavi Dhotre
2 years ago
@property
def place(self):
return self._place
@place.setter
def place(self, placeName):
if placeName not in ['Rome','France','Los Angeles ']:
self._place = 'Bangkok'
print('Not a Destination')
else:
self._place = placeName
print('Your Destination is here')
#python decorator examples
class Destination:
def __init__(self, place):
self.place=place
@property
def place(self):
return self._place
@place.setter
def place(self, placeName):
if placeName not in ['Rome','France','Los Angeles ']:
self._place = 'Bangkok'
print('Not a Destination')
else:
self._place = placeName
print('Your Destination is here')
d = Destination('Rome')