[Tutor] Weird iteration using zip()
Srinivas Iyyer
srini_iyyer_bio at yahoo.com
Thu Oct 27 17:59:31 CEST 2005
Hi all:
Here is a simple code:
>>> a = ['a','b','c','d','e']
>>> b = [1,2,3,4,5]
>>> abdict = dict(zip(a,b))
>>> abdict
{'a': 1, 'c': 3, 'b': 2, 'e': 5, 'd': 4}
Why is this weird iteration going on"
Why not:
>>> abdict
{'a':1,'b':2,'c':3,'d':4,'e':5}
Is there any hidden logic in the code that is making
abidct to have a , c, b, e, d sequence?
Any explanation..?
thanks
Sr
__________________________________
Start your day with Yahoo! - Make it your home page!
http://www.yahoo.com/r/hs
More information about the Tutor
mailing list