mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-23 07:29:02 -08:00
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:
@@ -9,12 +9,12 @@ Port by Dave LeCompte
|
||||
PAGE_WIDTH = 64
|
||||
|
||||
|
||||
def print_centered(msg):
|
||||
def print_centered(msg: str) -> None:
|
||||
spaces = " " * ((PAGE_WIDTH - len(msg)) // 2)
|
||||
print(spaces + msg)
|
||||
|
||||
|
||||
def print_header(title):
|
||||
def print_header(title: str) -> None:
|
||||
print_centered(title)
|
||||
print_centered("CREATIVE COMPUTING MORRISTOWN, NEW JERSEY")
|
||||
print()
|
||||
@@ -22,7 +22,7 @@ def print_header(title):
|
||||
print()
|
||||
|
||||
|
||||
def print_introduction():
|
||||
def print_introduction() -> None:
|
||||
print("I, YOUR FRIENDLY MICROCOMPUTER, WILL DETERMINE")
|
||||
print("THE CORRECT CHANGE FOR ITEMS COSTING UP TO $100.")
|
||||
print()
|
||||
@@ -35,7 +35,7 @@ def pennies_to_dollar_string(p):
|
||||
return ds
|
||||
|
||||
|
||||
def compute_change():
|
||||
def compute_change() -> None:
|
||||
print("COST OF ITEM?")
|
||||
cost = float(input())
|
||||
print("AMOUNT OF PAYMENT?")
|
||||
@@ -94,7 +94,7 @@ def compute_change():
|
||||
print(f"{change_in_pennies} PENNY(S)")
|
||||
|
||||
|
||||
def print_thanks():
|
||||
def print_thanks() -> None:
|
||||
print("THANK YOU, COME AGAIN.")
|
||||
print()
|
||||
print()
|
||||
|
||||
Reference in New Issue
Block a user