Skip to content

Instantly share code, notes, and snippets.

@a2chub
Created May 11, 2015 06:02
Show Gist options
  • Save a2chub/3ffcd699f30d9a8860f8 to your computer and use it in GitHub Desktop.
Save a2chub/3ffcd699f30d9a8860f8 to your computer and use it in GitHub Desktop.
#!/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