Created
May 13, 2022 11:03
-
-
Save travishen/58dbfe7169b89636c22c330e39f782c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CartItem: | |
def __init__(self, weight): | |
self.weight = weight | |
def get_weight(self): | |
return self.__weight | |
def set_weight(self, val): | |
if val > 0: | |
self.__weight = val | |
else: | |
raise ValueError() | |
weight = property(get_weight, set_weight) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment