# using words instead of numbers numbers = ["hello", "this", "is", "is", "is", "is", "a", "test", "of", "using", "words"] counter = 1 prev = numbers.pop() while len(numbers) > 0 and counter < 4: next = numbers.pop() if prev == next: counter = counter + 1 else: counter = 1 prev = next if counter == 4: print "Found repeated number" else: print "No repeated number found"