Skip to content

Instantly share code, notes, and snippets.

@blha303
Last active September 1, 2015 09:32
Show Gist options
  • Save blha303/65870af6c988a3a324b9 to your computer and use it in GitHub Desktop.
Save blha303/65870af6c988a3a324b9 to your computer and use it in GitHub Desktop.
My second attempt at FizzBuzz (now with less
#!/usr/bin/env python2
from sys import stdout, exit, argv
def main(start, end):
for i in xrange(int(start),int(end)+1):
q = False
if i % 3 == 0:
stdout.write("Fizz")
q = True
if i % 5 == 0:
stdout.write("Buzz")
q = True
if not q:
stdout.write(str(i))
stdout.write("\n")
return 0
if __name__ == "__main__":
if len(argv) == 3:
exit(main(*argv[1:]))
else:
exit(main(1, 100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment