BUG: Hangman (Python) had a List-vs-Str comparison

MAINT: Add type annotations to find such issues
This commit is contained in:
Martin Thoma
2022-03-31 10:33:11 +02:00
parent b31c624703
commit ae0b6a5015
22 changed files with 347 additions and 365 deletions

View File

@@ -20,7 +20,7 @@ def print_with_tab(space_count: int, msg: str) -> None:
print(spaces + msg)
def play_scenario():
def play_scenario() -> bool:
acid_amount = random.randint(1, 50)
water_amount = 7 * acid_amount / 3
@@ -43,27 +43,23 @@ def play_scenario():
return True
def show_failure():
def show_failure() -> None:
print(" SIZZLE! YOU HAVE JUST BEEN DESALINATED INTO A BLOB")
print(" OF QUIVERING PROTOPLASM!")
def show_success():
print(" GOOD JOB! YOU MAY BREATHE NOW, BUT DON'T INHALE THE FUMES!")
print()
def show_success() -> None:
print(" GOOD JOB! YOU MAY BREATHE NOW, BUT DON'T INHALE THE FUMES!\n")
def show_ending():
def show_ending() -> None:
print(f" YOUR {MAX_LIVES} LIVES ARE USED, BUT YOU WILL BE LONG REMEMBERED FOR")
print(" YOUR CONTRIBUTIONS TO THE FIELD OF COMIC BOOK CHEMISTRY.")
def main() -> None:
print_with_tab(33, "CHEMIST")
print_with_tab(15, "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY")
print()
print()
print()
print_with_tab(15, "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n\n\n")
print("THE FICTITIOUS CHEMICAL KRYPTOCYANIC ACID CAN ONLY BE")
print("DILUTED BY THE RATIO OF 7 PARTS WATER TO 3 PARTS ACID.")