Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created April 10, 2021 08:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jasongorman/04423791252e26bdb594e9ab35fd969b to your computer and use it in GitHub Desktop.
class CompactDisc(object):
def __init__(self, stock, price, payments: Payments):
self.payments = payments
self.price = price
self.stock = stock
def buy(self, quantity, credit_card):
self.stock -= quantity
self.payments.pay(credit_card, self.price)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment