I need to check if a Python list consists of two equal halves. For example, this list does:
[6, 2, 0, 2, 3, 2, 6, 2, 0, 2, 3, 2]
and this doesn't
[6, 2, 0, 2, 4, 6]
I've tried this check: len(lst) % 2 == 0 and lst[:len(lst)//2] == lst[len(lst)//2:]
but it seems to be too slow for bigger lists. Any other solutions?