Skip to content

Instantly share code, notes, and snippets.

@dp-quant
Created March 4, 2019 18:10
Show Gist options
  • Save dp-quant/1bed5a74642de55f739c2fa7a668f713 to your computer and use it in GitHub Desktop.
Save dp-quant/1bed5a74642de55f739c2fa7a668f713 to your computer and use it in GitHub Desktop.
class Building:
__matherial = None
__color = None
__quantity = 0
def __init__(self, matherial, color, number = 0):
self.__matherial = matherial
self.__color = color
self.__quantity = number
def place(self):
if self.__quantity <= 0:
return 'out of stock'
elif 0 < self.__quantity <= 100:
return 'warehouse'
else:
return 'remote warehouse'
b1 = Building('iron', 'gray', 100)
b2 = Building('brick', 'red', 50)
b3 = Building('wood', 'green', 1500)
b4 = Building('silver', 'grey')
print(b1.place())
print(b2.place())
print(b3.place())
print(b4.place())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment