This is my list
myList = ['Bob', '5-10', 170, 'Tom', '5-5', 145, 'Bill', '6-5', '215']
I want to make into a dictionary like this.
{'Bob': ['5-10', 170], 'Bill': ['6-5', '215'], 'Tom': ['5-5', 145]}
I came up with this but it is very ugly and doesn't scale up.
def MakeDict():
d = {}
for x, i in zip(myList, range(len(myList))):
if i in (0, 3, 6):
name = x
elif i in (1, 4, 7):
hieght = x
elif i in (2, 5, 8):
wieght = x
d[name] = [hieght, wieght]
return d
What can I do?