How could I use list comprehension to solve this?

The following approach uses list comprehensions, but it starts to get a bit messy…

def same_values(L1, L2):
  return [k for k in range(min(len(L1), len(L2))) if L1[k] == L2[k]]
2 Likes