> Problem:
> How do i capture every alternative element in list a:

Use Jeff Shannon's approach to get keys and vals.

> >>> keys = [] # create a list of all keys i.e a,b,c)
> >>> vals = [] # create a list of all values i.e 
>                #appele,boy,cat etc.
> 
> >>> dict = {}
> 
> >>> dict = zip(keys,vals)


What is that?!?
your dict thing ain't workin'
This is verified code... HA,HA,HA,Ha, ha, ha 
Well... okay, it's only tested, not verified.

fulllist = ['a','apple','b','boy','c','cat']
keys = fulllist[::2]
vals = fulllist[1::2]
dictionary = dict(zip(keys,vals))

HTH,
Jacob


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to