Created
May 11, 2015 06:02
-
-
Save a2chub/3ffcd699f30d9a8860f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#coding:utf-8 | |
def basic(): | |
for i in range(100): | |
if i%2 ==0: | |
print i | |
def oneLine(counts): | |
print '\n'.join([str(x) for x in range(counts+1) if x%2 == 0]) | |
def fizzbuzz(cnt): | |
for i in range(1, cnt+1): | |
if i %15 == 0: | |
print str(i), "\t: fizzBuzz" | |
elif i % 3 == 0: | |
print str(i), '\t: fizz' | |
elif i % 5 == 0: | |
print str(i), '\t: buzz' | |
else: | |
print str(i), '\t:',i | |
if __name__ == '__main__': | |
#basic() | |
oneLine( 14 ) | |
fizzbuzz(10000) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment