Birincisinin ikinciden tam olarak bir tane daha fazla öğe içermesi garantili iki listem var . Çift indeks değerleri ilk listeden ve tek indeks değerleri ikinci listeden gelen yeni bir liste oluşturmanın en Pythonic yolunu bilmek istiyorum.
# example inputs
list1 = ['f', 'o', 'o']
list2 = ['hello', 'world']
# desired output
['f', 'hello', 'o', 'world', 'o']
Bu işe yarıyor, ancak hoş değil:
list3 = []
while True:
try:
list3.append(list1.pop(0))
list3.append(list2.pop(0))
except IndexError:
break
Bu başka nasıl başarılabilir? En Pythonic yaklaşım nedir?