Skip to content

Instantly share code, notes, and snippets.

@hyohannesgithub
Forked from jaysonrowe/FizzBuzz.py
Created September 30, 2017 00:34
Show Gist options
  • Select an option

  • Save hyohannesgithub/8bebe638d333bb506b12c63116e7f68f to your computer and use it in GitHub Desktop.

Select an option

Save hyohannesgithub/8bebe638d333bb506b12c63116e7f68f to your computer and use it in GitHub Desktop.

Revisions

  1. @jaysonrowe jaysonrowe created this gist Jan 11, 2012.
    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 xrange(1, 21))