language: Python (python 2.7.3)
date: 198 days 0 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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"