Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Start/Ch 3/challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ def __init__(self, ticker, price, company):
self.company = company
self.ticker = ticker

def __str__(self):
return f"{self.ticker}: {self.company_name} -- ${self.price}"

def __lt__(self, other):
return self.price < other.price


class Bond(Asset):
def __init__(self, price, description, duration, yieldamt):
Expand All @@ -31,6 +37,12 @@ def __init__(self, price, description, duration, yieldamt):
self.duration = duration
self.yieldamt = yieldamt

def __str__(self):
return f"{self.description}: {self.duration}yr : ${self.price} : {self.yieldamt}%"

def __lt__(self, other):
return self.yieldamt < other.yieldamt


# ~~~~~~~~~ TEST CODE ~~~~~~~~~
stocks = [
Expand Down