mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 15:16:33 -08:00
BUG: Hangman (Python) had a List-vs-Str comparison
MAINT: Add type annotations to find such issues
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import random
|
||||
from typing import List
|
||||
|
||||
|
||||
def print_intro() -> None:
|
||||
@@ -30,7 +31,7 @@ def print_instructions() -> None:
|
||||
print()
|
||||
|
||||
|
||||
def read_10_numbers():
|
||||
def read_10_numbers() -> List[int]:
|
||||
print("TEN NUMBERS, PLEASE ? ")
|
||||
numbers = []
|
||||
|
||||
@@ -47,7 +48,7 @@ def read_10_numbers():
|
||||
return numbers
|
||||
|
||||
|
||||
def read_continue_choice():
|
||||
def read_continue_choice() -> bool:
|
||||
print("\nDO YOU WANT TO TRY AGAIN (1 FOR YES, 0 FOR NO) ? ")
|
||||
try:
|
||||
choice = int(input())
|
||||
|
||||
Reference in New Issue
Block a user