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

@@ -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: