Python: Add types / fix type issues

This commit is contained in:
Martin Thoma
2022-04-02 09:12:13 +02:00
parent 71bae5ded3
commit 68cfd1c751
4 changed files with 10 additions and 10 deletions

View File

@@ -86,12 +86,12 @@ def show_fort_comment(which_fort):
print()
def get_yes_or_no():
def get_yes_or_no() -> str:
"""Prompt the player to enter 'YES' or 'NO'. Keep prompting until
valid input is entered. Accept various spellings by only
checking the first letter of input.
Return a single letter 'Y' or 'N'"""
result = 0
result = ""
while result not in ("Y", "N"):
print("ANSWER YES OR NO")
player_choice = input(">> ")