mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2024-12-08 00:45:29 +01:00
23 lines
548 B
Python
23 lines
548 B
Python
import sys
|
|
|
|
input_values: list[str] = []
|
|
for value in sys.stdin:
|
|
input_values.append(value.rstrip('\n'))
|
|
|
|
|
|
def fizzbuzz(length: int) -> None:
|
|
for number in range(1, length + 1, 1):
|
|
is_divisible_by_3 = number % 3 == 0
|
|
is_divisible_by_5 = number % 5 == 0
|
|
if is_divisible_by_3 and is_divisible_by_5:
|
|
print("FizzBuzz")
|
|
elif is_divisible_by_3:
|
|
print("Fizz")
|
|
elif is_divisible_by_5:
|
|
print("Buzz")
|
|
else:
|
|
print(number)
|
|
|
|
|
|
fizzbuzz(int(input_values[0]))
|