I have 2 lists:
b = ['zero', 'one', 'two']
c = [0, 0, 0, 1, 1, 2, 1, 0, 2, 0]
Is there an elegant way to change every element in c and get
c = ['zero', 'zero', 'zero', 'one', 'one', 'two', 'one', 'zero', 'two', 'zero']
I have 2 lists:
b = ['zero', 'one', 'two']
c = [0, 0, 0, 1, 1, 2, 1, 0, 2, 0]
Is there an elegant way to change every element in c and get
c = ['zero', 'zero', 'zero', 'one', 'one', 'two', 'one', 'zero', 'two', 'zero']
Another way using itemgetter:
from operator import itemgetter
itemgetter(*c)(b)
Output:
('zero', 'zero', 'zero', 'one', 'one', 'two', 'one', 'zero', 'two', 'zero')