1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2024-11-09 22:08:58 +01:00
programming-challenges/challenges/fizzbuzz/solutions/python/function/solution.py

23 lines
548 B
Python
Raw Normal View History

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]))