mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2024-11-09 22:08:58 +01:00
24 lines
572 B
Python
24 lines
572 B
Python
from typing import List
|
|
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]))
|