Skip to content

Instantly share code, notes, and snippets.

@mvallebr
Created October 2, 2014 14:06
Show Gist options
  • Save mvallebr/08117f1bb6decc9a5cc5 to your computer and use it in GitHub Desktop.
Save mvallebr/08117f1bb6decc9a5cc5 to your computer and use it in GitHub Desktop.
numeros.py
import sys
convert = {1:0, 2:1, 3:1, 4:0, 5:1, 6:0, 7:1, 8:0, 9:0, 0:0}
a = [1,2,3,4,5,6,7,8,9,0]
print "Original array", str(a)
print "Converted array",
itera = (convert[key] for key in a)
for v in itera:
sys.stdout.write('%d' % v)
print ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment