Advertisement
pacho_the_python

Untitled

Jul 11th, 2022
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. class Dough:
  2.     def __init__(self, flour_type, baking_technique, weight):
  3.         self.flour_type = flour_type
  4.         self.baking_technique = baking_technique
  5.         self.weight = weight
  6.    
  7.     @property
  8.     def flour_type(self):
  9.         return self.__flour_type
  10.  
  11.     @flour_type.setter
  12.     def flour_type(self, value):
  13.         if not value:
  14.             raise ValueError("The flour type cannot be an empty string")
  15.         self.__flour_type = value
  16.  
  17.     @property
  18.     def baking_technique(self):
  19.         return self.__baking_technique
  20.  
  21.     @baking_technique.setter
  22.     def baking_technique(self, value):
  23.         if not value:
  24.             raise ValueError("The baking technique cannot be an empty string")
  25.         self.__baking_technique = value
  26.  
  27.     @property
  28.     def weight(self):
  29.         return self.__weight
  30.  
  31.     @weight.setter
  32.     def weight(self, value):
  33.         if value <= 0:
  34.             raise ValueError("The weight cannot be less or equal to zero")
  35.         self.__weight = value
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement