I have a list and I want to convert this list into map
mylist = ["a",1,"b",2,"c",3]
mylist is equivalent to
mylist = [Key,Value,Key,Value,Key,Value]
So Input:
mylist = ["a",1,"b",2,"c",3]
Output:
mymap = {"a":1,"b":2,"c":3}
P.S: I already have written following function that do same work, but I want to use iterator tools of python:
def fun():
mylist = ["a",1,"b",2,"c",3]
mymap={}
count = 0
for value in mylist:
if not count%2:
mymap[value] = mylist[count+1]
count = count+1
return mymap