Advertisement
johnpentyrch

room

May 4th, 2020
699
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. class Room():
  2.     def __init__(self,room_name):
  3.         self.name=room_name
  4.         self.description=None
  5.        
  6.     def set_description(self, room_description):
  7.         self.description = room_description
  8.        
  9.     def get_description(self):
  10.         return self.description
  11.  
  12.     def set_name(self, room_name):
  13.         self.name = room_name
  14.        
  15.     def get_name(self):
  16.         return self.name
  17.    
  18.     def describe(self):
  19.         print( self.description )
  20.  
  21. if __name__ == "__main__":
  22.     a=Room('Dinning Room')
  23.     a.set_description('The place to cook')
  24.  
  25.  
  26.     print(a.get_name())
  27.     print(a.get_description())
  28.  
  29.     a.set_name('Bathroom')
  30.     a.set_description('The place to wash your hands')
  31.  
  32.     print(a.get_name())
  33.     print(a.get_description())
  34.     a.describe()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement