fizzbuzz.py

```python """ FizzBuzz Rules: Make a function that prints a range of numbers (1-100 by default) If the number is: a) a multiple of 5, print 'Fizz' b) a multiple of 7, print 'Buzz' c) a multiple of 15, print 'FizzBuzz' Otherwise, print the number. Example output (1-20): 1 2 3 4 Fizz 6 Buzz 8 9 Fizz 11 12 13 Buzz FizzBuzz 16 17 18 19 Fizz """ def fizzbuzz(iterations: int = 100): for index in range(1, iterations+1): if not index % 15: print('FizzBuzz') elif not index % 5: print('Fizz') elif not index % 7: print('Buzz') else: print(index) fizzbuzz() ```

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.