If you had a list of lists like mylist below
mylist = [['start', 'a', 'next'],['next','b','end'],['previous','c','start']]
how would you create a dictionary where the key is equal to list[0][0] and the value=list
for example the dictionary would be:
{'start': ('a', 'next'), 'next': ('b', 'end'), 'previous': ('c', 'start')}
I am trying to create a transition function to traverse through a lists of lists which hold the transitions.
NEW
I am now trying to do a list comprehension but I keep getting "IndexError: string index out of range" with this code
d = {x[0]: (x[1],x[2]) for x in self.epsilon}
print(d)
my list is stored in self.epsilon which equals: self.epsilon = [['q1', '0', 'q1'],['q1','1', 'q2'], ['q2','0','q2'], ['q2', '1', 'q1']]