Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,9 @@
for i in xrange(1, 101):
if i % 15 == 0:
print "FizzBuzz"
elif i % 3 == 0:
print "Fizz"
elif i % 5 == 0:
print "Buzz"
else:
print i

View file

@ -0,0 +1,33 @@
'''Fizz buzz'''
from itertools import count, cycle, islice
# fizzBuzz :: () -> Generator [String]
def fizzBuzz():
'''A non-finite stream of fizzbuzz terms.
'''
return map(
lambda f, b, n: (f + b) or str(n),
cycle([''] * 2 + ['Fizz']),
cycle([''] * 4 + ['Buzz']),
count(1)
)
# ------------------------- TEST -------------------------
def main():
'''Display of first 100 terms of the fizzbuzz series.
'''
print(
'\n'.join(
list(islice(
fizzBuzz(),
100
))
)
)
if __name__ == '__main__':
main()

View file

@ -0,0 +1 @@
print(*map(lambda n: 'Fizzbuzz '[(i):i+13] if (i := n**4%-15) > -14 else n, range(1,100)))

View file

@ -0,0 +1,12 @@
def numsum(n):
''' The recursive sum of all digits in a number
unit a single character is obtained'''
res = sum([int(i) for i in str(n)])
if res < 10: return res
else : return numsum(res)
for n in range(1,101):
response = 'Fizz'*(numsum(n) in [3,6,9]) + \
'Buzz'*(str(n)[-1] in ['5','0'])\
or n
print(response)

View file

@ -0,0 +1 @@
print(*((lambda x=x: ''.join(chr(c) for c in (102, 105)) + (2 * chr(122)) + ''.join(chr(c) for c in (98, 117)) + (2 * chr(122)) + '\n' if x % (30 >> 1) == 0 else ''.join(chr(c) for c in (102, 105)) + (2 * chr(122)) + '\n' if x % (6 >> 1) == 0 else ''.join(chr(c) for c in (98, 117)) + (2 * chr(122)) + '\n' if x % (10 >> 1) == 0 else str(x) + '\n')() for x in range(1, 101)))

View file

@ -0,0 +1,9 @@
for i in range(1, 101):
if i % 15 == 0:
print("FizzBuzz")
elif i % 3 == 0:
print("Fizz")
elif i % 5 == 0:
print("Buzz")
else:
print(i)

View file

@ -0,0 +1,9 @@
for n in range(1,101):
response = ''
if not n%3:
response += 'Fizz'
if not n%5:
response += 'Buzz'
print(response or n)

View file

@ -0,0 +1 @@
for i in range(1,101): print("Fizz"*(i%3==0) + "Buzz"*(i%5==0) or i)

View file

@ -0,0 +1 @@
for i in range(100):print(i%3//2*'Fizz'+i%5//4*'Buzz'or i+1)

View file

@ -0,0 +1,3 @@
for n in range(1, 100):
fb = ''.join([ denom[1] if n % denom[0] == 0 else '' for denom in [(3,'fizz'),(5,'buzz')] ])
print fb if fb else n

View file

@ -0,0 +1 @@
print (', '.join([(x%3<1)*'Fizz'+(x%5<1)*'Buzz' or str(x) for x in range(1,101)]))

View file

@ -0,0 +1 @@
[print("FizzBuzz") if i % 15 == 0 else print("Fizz") if i % 3 == 0 else print("Buzz") if i % 5 == 0 else print(i) for i in range(1,101)]

View file

@ -0,0 +1,13 @@
from itertools import cycle, izip, count, islice
fizzes = cycle([""] * 2 + ["Fizz"])
buzzes = cycle([""] * 4 + ["Buzz"])
both = (f + b for f, b in izip(fizzes, buzzes))
# if the string is "", yield the number
# otherwise yield the string
fizzbuzz = (word or n for word, n in izip(both, count(1)))
# print the first 100
for i in islice(fizzbuzz, 100):
print i