adventofcode2019/4/4-2.py
2019-12-06 13:03:45 +00:00

27 lines
No EOL
433 B
Python
Executable file

#!/usr/bin/env python3
import sys
start = 125730
end = 579381
for x in range(start, end+1):
s = str(x)
fail=False
double=False
matchcount = 1
for n in range(0,5):
if s[n] > s[n+1]:
fail = True
break
if s[n] == s[n+1]:
matchcount += 1
else:
if matchcount == 2:
double = True
matchcount = 1
if matchcount == 2:
double = True
if double and not fail:
print(x)