Created
November 15, 2012 16:22
-
-
Save natw/4079502 to your computer and use it in GitHub Desktop.
best fizzbuzz
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
import random | |
for i in range(0, 100): | |
if not i % 15: | |
random.seed(1178741599) | |
print [i+1, "Fizz", "Buzz", "FizzBuzz"][random.randint(0,3)] |
Vintage style, hahahha 😄
for i in range(1,11):
if i % 3 == 0:
print "fizz"
elif i % 5 == 0:
print "buzz"
elif i % 3 == 0 and i % 5 == 0:
print "fizz buzz"
else
print i
That last one doesn't work. For numbers which are both divisible by 3 and 5, it prints only "fizz", not "fizz buzz" as it should.
And there is a missing ':' after the 'else' keyword.
import requests
print requests.get("https://s3.amazonaws.com/fizzbuzz/output").content
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Brute force?