неделя, 26 януари 2025 г.

 Крави и бикове

numbers = []


for x in range(1234,9877):

  text = str(x)

  n0 = text.count(text[0])

  n1 = text.count(text[1])

  n2 = text.count(text[2])

  n3 = text.count(text[3])

  if text.count("0")==0 and n0==1 and n1==1 and n2==1 and n3==1:

    numbers.append(x)


print(numbers) 

print (len(numbers))

Няма коментари:

Публикуване на коментар