Skip to content

Instantly share code, notes, and snippets.

@springcoil
Created December 21, 2015 21:18
Show Gist options
  • Save springcoil/7ccbd1342727935c38c4 to your computer and use it in GitHub Desktop.
Save springcoil/7ccbd1342727935c38c4 to your computer and use it in GitHub Desktop.

Revisions

  1. springcoil created this gist Dec 21, 2015.
    12 changes: 12 additions & 0 deletions fizzbuzz.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    def fizzbuzz(n):

    if n % 3 == 0 and n % 5 == 0:
    return 'FizzBuzz'
    elif n % 3 == 0:
    return 'Fizz'
    elif n % 5 == 0:
    return 'Buzz'
    else:
    return str(n)

    print("\n".join(fizzbuzz(n) for n in range(1, 121)))