Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
RhysAlfShaw authored Dec 15, 2023
2 parents 3140ed3 + c1a4d94 commit 000a7fb
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions manipulations/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

T = TypeVar("T")

def is_fizz_buzz(n: int) -> bool:
"""
Check if a number is divisible by 3 or 5
"""
is_divisible_by_3 = n % 3 == 0
is_divisible_by_5 = n % 5 == 0
return is_divisible_by_3 or is_divisible_by_5 and not (is_divisible_by_3 and is_divisible_by_5)

def fizz_buzz_access(items: list) -> list:
def _is_fizz_buzz(i: int) -> bool:
is_div_3 = i % 3 == 0
is_div_5 = i % 5 == 0

return (is_div_3 or is_div_5) and not (is_div_3 and is_div_5)

def fizz_buzz_access(items: list[T]) -> list[T]:
"""
Access the list according to the fizz-buzz pattern, that is, elements
are included if the index
Expand Down

0 comments on commit 000a7fb

Please sign in to comment.