mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-25 04:15:45 -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:
@@ -12,12 +12,12 @@ import random
|
||||
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()
|
||||
@@ -25,7 +25,7 @@ def print_header(title):
|
||||
print()
|
||||
|
||||
|
||||
def print_instructions():
|
||||
def print_instructions() -> None:
|
||||
print("YOU ARE THE WEAPONS OFFICER ON THE STARSHIP ENTERPRISE")
|
||||
print("AND THIS IS A TEST TO SEE HOW ACCURATE A SHOT YOU")
|
||||
print("ARE IN A THREE-DIMENSIONAL RANGE. YOU WILL BE TOLD")
|
||||
|
||||
Reference in New Issue
Block a user