Advertisement
aidanpl

oo_programming_4_5_item.py

Feb 25th, 2020
522
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. # Item class - min documentation :-)
  2. class Item():
  3.     def __init__(self, item_name, item_description):
  4.         self.name = item_name
  5.         self.description = item_description
  6.  
  7.     def set_name(self, item_name):
  8.         self.name = item_name
  9.  
  10.     def get_name(self):
  11.         return self.name
  12.  
  13.     def set_description(self, item_description):
  14.         self.description = item_description
  15.  
  16.     def get_description(self):
  17.         return self.description    
  18.  
  19.     # Instead of returning, print the description
  20.     def describe(self):
  21.         print("")
  22.         print("A " + self.name + " is here!")
  23.         print( self.description )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement