Last active
October 11, 2021 02:38
-
-
Save ycui1/7e35d7a82a39ff1f5132ef2337bc9d0e 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 Product: | |
... def __init__(self, name, price): | |
... self.name = name | |
... self.price = price | |
... | |
... @property | |
... def employee_price(self): | |
... return self.price * 0.9 | |
... | |
>>> vacuum = Product("Vacuum", 200) | |
>>> vacuum.employee_price | |
180.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment