I have three lists. Two lists of string, and one list of float. I used zip to match one list of string and float together that are the same length to make a new string. Basically:
letters1 = ['a', 'b', 'c', 'd', 'e']
numbers = [0.0, 3.0, 5.0, 10.0, 28.0]
letters2 = ['a', 'c', 'e']
letnum = [i for i in zip(letters1, numbers)]
This gets me:
[('a', 0.0), ('b', 3.0), ('c', 5.0), ('d', 10.0), ('e', 28.0)]
I want to use the other list to get only [0.0, 5.0, 28.0], but I don't know how to return a list of float like that.
I tried using [x for x in letnum if x in letters2] but that gave me [].
I also know letnum = [i for _, i in zip(letters1, numbers)] will get me [0.0, 3.0, 5.0, 10.0, 28.0] but I don't know if that does anything.
Any help would be appreciated!