I need to iterate variable Y, compare each iteration with variable sublist Variable X and create a new string with results.
Y = 'ABCEF'
X =[('A', 1),('B', 4),('C', 6),('D', 7),('E', 8),('F', 9),('G', 10),('H', 11),('I', 12),('J', 13),('K', 14),('L', 15),('M', 16)]
The result is below after iterating Y.
Z = '14689'
Can someone shade some light on the resolution of this.
Y = 'ABCEF'
X =[('A', 1),('B', 4),('C', 6),('D', 7),('E', 8),('F', 9),('G', 10),('H', 11),('I', 12),('J', 13),('K', 14),('L', 15),('M', 16)]
j <= len(X) - 1
result = ''
for i in Y:
if i in X[0][j]:
result.append(X[j])
else:
j = j -1
Xstored as a string (a la JSON) or is that a literal Python list?