This poll = ['Kassel', 33, 'Berlin', 25, 'Hamburg', 23]
should convert to {'Kassel': 33, 'Berlin': 25, 'Hamburg': 23}
.
This works:
location = poll[::2]
result = poll[1::2]
poll = dict(zip(location, result))
Is there a faster, more pythonic way to pair values in a list of length n?