from itertools import izip
c1 = ["ft","fu","fs","fv"]
c2 = ["gt","gu","gs","gv"]
c3 = ["ht","hu","hs","hv"]
c4 = ["it","iu","is","iv"]
c = [c1,c2,c3,c4]
ind = ["r1","r2","r3","r4"]
def showit(c):
for i in c:
for k in i:
print k
def izipit(c):
for (i,k) in izip(ind, c):
print i
print k
def zipit(ind, c):
d = dict(zip(ind, c))
return d
print "showit(c)"
showit(c)
print "izipit(c)"
izipit(c)
print "zipit(c)"
print zipit(ind, c)
Saturday, March 13, 2010
March Madness Challenge - Day 13
Exploration of the zip, izip functions in Python. The code doesn't really get to the meaning and best use of the zip, and izip functions. Another piece of code I'm going to have to revisit later. I'll be exploring Python test frameworks soon, hopefully, I can revisit the testing and bench marking using one of the official Python frameworks.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment