Skip to content

Instantly share code, notes, and snippets.

@showyou
Created August 8, 2012 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save showyou/3299077 to your computer and use it in GitHub Desktop.
Save showyou/3299077 to your computer and use it in GitHub Desktop.
fizzbuzz
def print_fizzbuzz( max_num ):
for n in xrange( 1, max_num):
if( n % 5 == 0 and n % 3 == 0 ):
print "fizzbuzz"
elif( n % 5 == 0):
print "fizz"
elif( n % 3 == 0):
print "buzz"
else:
print n
print ("input max number")
max_num = int(raw_input());
print_fizzbuzz(max_num);
input max number
20
1
2
buzz
4
fizz
buzz
7
8
buzz
fizz
11
buzz
13
14
fizzbuzz
16
17
buzz
19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment