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,7 +9,7 @@ Ported by Dave LeCompte
|
||||
import random
|
||||
|
||||
|
||||
def print_with_tab(num_spaces, msg):
|
||||
def print_with_tab(num_spaces: int, msg: str) -> None:
|
||||
if num_spaces > 0:
|
||||
spaces = " " * num_spaces
|
||||
else:
|
||||
@@ -18,7 +18,7 @@ def print_with_tab(num_spaces, msg):
|
||||
print(spaces + msg)
|
||||
|
||||
|
||||
def print_instructions():
|
||||
def print_instructions() -> None:
|
||||
print("YOU HAVE 100 POINTS. BY GUESSING NUMBERS FROM 1 TO 5, YOU")
|
||||
print("CAN GAIN OR LOSE POINTS DEPENDING UPON HOW CLOSE YOU GET TO")
|
||||
print("A RANDOM NUMBER SELECTED BY THE COMPUTER.")
|
||||
|
||||
Reference in New Issue
Block a user