mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-01-10 20:25:34 -08:00
BUG: Hangman (Python) had a List-vs-Str comparison
MAINT: Add type annotations to find such issues
This commit is contained in:
@@ -65,7 +65,7 @@ def parse_input() -> Tuple[int, bool]:
|
||||
return day, leap_day
|
||||
|
||||
|
||||
def calendar(weekday, leap_year):
|
||||
def calendar(weekday: int, leap_year: bool) -> None:
|
||||
"""
|
||||
function to print a year's calendar.
|
||||
|
||||
@@ -104,9 +104,8 @@ def calendar(weekday, leap_year):
|
||||
for n in range(1, 13):
|
||||
days_count += months_days[n - 1]
|
||||
print(
|
||||
"** {} ****************** {} ****************** {} **\n".format(
|
||||
days_count, months_names[n - 1], years_day - days_count
|
||||
)
|
||||
f"** {days_count} ****************** {months_names[n - 1]} "
|
||||
f"****************** {years_day - days_count} **\n"
|
||||
)
|
||||
print(days)
|
||||
print(sep)
|
||||
@@ -121,7 +120,7 @@ def calendar(weekday, leap_year):
|
||||
break
|
||||
|
||||
if d2 <= 0:
|
||||
print("{}".format(" "), end=" ")
|
||||
print(" ", end=" ")
|
||||
elif d2 < 10:
|
||||
print(f" {d2}", end=" ")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user