2 ms·
My eyes start glazing a bit from the strain of checking whether the variable names match or not. I prefer def calculate_points(word: str) -> int: c
by im3w1l 4y ago
My eyes start glazing a bit from the strain of checking whether the variable names match or not. I prefer
def calculate_points(word: str) -> int:
count = sum(x != '.' for x in word)
return _award_points_for_letters(count)
- maccard 4y agoI think that's unrelated to the type annotations though. Using the other function: def _award_points_for_letters(guessed: int) -> int: return 0 if guessed < 5 else guessed # minimum 6 points possible! vs def _award_points_for_letters(guessed): return 0 if guessed < 5 else guessed # minimum 6 points possible! is "guessed" letters or is it the number guessed?