Can you provide some more examples of the input. For this specific one I came up with this. It’s a bad solution, so would like to know better.
def fun(inp1, inp2):
lst = []
for i in range(max(len(inp1), len(inp2))):
if i == 0:
dct = {inp1[i]: inp2[i], inp1[i+1]: inp2[i+1]}
lst.append(dct)
elif i == 1:
dct = {inp1[i-1]: inp2[i], inp1[i]: inp2[i-1]}
lst.append(dct)
return lst