Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Fold an array
#python 2.7.12 print "Hello, world!" arr = [1, 2, 3, 4, 5]#python 2.7.12 array = [0, 0, 0, 0, 0] i=0 runs=3 while i < runs : lar= len(array)//2 med=array[lar] if len(array)%2 else 0 array=[sum(x) for x in zip(array[:lar:], array[:lar-1:-1])] array if med==0 else array.append(med) i+=1 print array print lar print med
run
|
edit
|
history
|
help
0
WoW
Speed up Python2 nested loops with XOR
Printing
mad libs game
Aisha Wall
project euler 16
Aufgabe 16
espacio_blanco
Dictionary
PySet