''' How do I avoid repition in for loops python ''' my_list = [1, 2, 3, 4, 5] for i, val in enumerate(my_list): if i > 0 and val == my_list[i-1]: # Do not repeat operation on same value continue # Do something with the value