Hackbright Code Challenges

FizzBuzz: Solution

FizzBuzz: Solution

Problem

FizzBuzz

Whiteboard

Easier

Concepts

Loops

Download

fizzbuzz-solution.zip


def fizzbuzz():
    """Count from 1 to 20 in fizzbuzz fashion."""

    # START SOLUTION

    for i in range(1, 21):

        if i % 15 == 0:
            print("fizzbuzz")

        elif i % 3 == 0:
            print("fizz")

        elif i % 5 == 0:
            print("buzz")

        else:
            print(i)