September Morn Update

This commit is contained in:
Ingy döt Net 2019-09-12 10:33:56 -07:00
parent 4e2d22a71d
commit aac6731f2c
6856 changed files with 141342 additions and 21127 deletions

View file

@ -1,16 +1,10 @@
try:
from itertools import zip_longest
except:
try:
from itertools import izip_longest as zip_longest
except:
zip_longest = lambda *args: map(None, *args)
#!/bin/python3
from itertools import zip_longest
def beadsort(l):
return map(len, columns(columns([[1] * e for e in l])))
return list(map(sum, zip_longest(*[[1] * e for e in l], fillvalue=0)))
def columns(l):
return [filter(None, x) for x in zip_longest(*l)]
# Demonstration code:
print(beadsort([5,3,1,7,4,1,1]))