From random import randint
a=[]
pre=-1
c=None
for i in xrange(25):
b=randint(0, 5)
if pre == b:
c=b
pre=b
a.append(b)
print "Исходный массив: %s, Одинаковые числа: %s".decode("utf-8")%(a, "Есть: %i".decode("utf-8")%(c) if c is not None else "Нет".decode("utf-8"))