Skip to content

Instantly share code, notes, and snippets.

View garethjwilliams's full-sized avatar

Gareth Williams garethjwilliams

View GitHub Profile
@garethjwilliams
garethjwilliams / py_fizzbuzz_nodivmod
Created October 28, 2013 18:33
Naive Python fizzbuzz with no divide or modulo.
def fizzbuzz(stop):
count_3 = count_5 = 0
for i in range(1, stop + 1):
count_3 += 1
count_5 += 1
if count_3 == 3 and count_5 == 5:
print('fizzbuzz')
count_3 = count_5 = 0
elif count_3 == 3:
print('fizz')
@garethjwilliams
garethjwilliams / py_fizzbuzz_nodivmod2
Created October 29, 2013 07:13
Naive Python fizzbuzz with no divide or modulo, variable positive start point.
def fizzbuzz(start=1, stop=100):
count_3 = count_5 = 0
for i in range(1, stop + 1):
count_3 += 1
count_5 += 1
if count_3 == 3 and count_5 == 5:
out = 'fizzbuzz'
count_3 = count_5 = 0
elif count_3 == 3:
out = 'fizz'