values = ['random word1', 20, 'random word2', 54]
values = list(map(list,zip(values[::2], values[1::2])))
print(values)
[['random word1', 20], ['random word2', 54]]
Now I want to fetch values like this:
if ‘random word2’ in values:
get the value associated with random word 2 which is in this case 54.
Note: string words and values are random.
How can I do that?
I need to fetch the correct value.
dictinstead of a list of tuples?