I am working on my very first coding project, which is to make a text encoder. Once complete, I plan to make the decoder that will pair with it. For now, I am having trouble getting two lists to combine/overlap. I apologize if what I am about to show has an actual name that references it, I am new to coding and still learning many things.
list1 = [20.0, 'X', 'X', 46.0, 0.0, 18.0, 'X', 40.0]
list2 = ['Y', 31.0, 45.0, 'Y', 'Y', 'Y', 47.0, 'Y']
I need the output to be:
list3 = [20.0, 31.0, 45.0, 46.0, 0.0, 18.0, 47.0, 40.0]
Both lists have an equal number of values, and I need to combine them into one list, keep the numbers in their current order, and eliminate the "X"s and "Y"s entirely.