1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2024-12-08 00:45:29 +01:00

feat(solutions): add fizzbuzz/python/function

This commit is contained in:
Divlo 2021-06-30 13:35:26 +02:00
parent 685eeb9de9
commit 70e7c937d0
No known key found for this signature in database
GPG Key ID: 185ED2F15F104E52
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,3 @@
# fizzbuzz/python/function
Created by [@Divlo](https://github.com/Divlo) on 30 June 2021.

View File

@ -0,0 +1,23 @@
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]))