Python: Add type annotations to all 'print' functions (#662)

* Add test to superstartrek and fixes several issues in superstartrek - I probably introduced them 🙈
* Mastermind type annotations
This commit is contained in:
Martin Thoma
2022-03-21 10:41:14 +01:00
committed by GitHub
parent c444da93c0
commit 1b1d50986b
50 changed files with 241 additions and 172 deletions

View File

@@ -49,7 +49,7 @@ class Stock_Market:
for stock, change in zip(self.data.values(), self.changes):
stock["Price"] = round(stock["Price"] + (change / 100) * stock["Price"], 2)
def print_exchange_average(self):
def print_exchange_average(self) -> None:
sum = 0
for stock in self.data.values():
@@ -65,7 +65,7 @@ class Stock_Market:
return round(sum / 5, 2)
def print_first_day(self):
def print_first_day(self) -> None:
print("\nSTOCK\t\t\t\t\tINITIALS\tPRICE/SHARE($)")
for stock, data in self.data.items():
@@ -94,7 +94,7 @@ class Stock_Market:
return new_holdings
def print_trading_day(self):
def print_trading_day(self) -> None:
print("STOCK\tPRICE/SHARE\tHOLDINGS\tNET. Value\tPRICE CHANGE")
for stock, data, change in zip(
@@ -128,7 +128,7 @@ class Stock_Market:
self.stock_assets = round(sum, 2)
def print_assets(self):
def print_assets(self) -> None:
print(f"\nTOTAL STOCK ASSETS ARE: ${self.stock_assets:.2f}")
print(f"TOTAL CASH ASSETS ARE: ${self.cash_assets:.2f}")
@@ -162,7 +162,7 @@ class Stock_Market:
stock["Holdings"] += new_holding
def print_instruction():
def print_instruction() -> None:
print(
"""