Skip to content

Instantly share code, notes, and snippets.

@ycui1
Last active Oct 11, 2021
Embed
What would you like to do?
>>> 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