[Python/2019] Restructure solutions

This commit is contained in:
Felix Bargfeldt 2023-10-29 19:47:15 +01:00
parent 40e767096e
commit fb42493fff
Signed by: Defelo
GPG key ID: 2A05272471204DD3
63 changed files with 1393 additions and 1739 deletions

24
Python/2019/04.py Normal file
View file

@ -0,0 +1,24 @@
from lib import *
input = read_input(2019, 4)
a, b = map(int, input.split("-"))
count = 0
for i in range(a, b + 1):
string = str(i)
if list(string) != sorted(string):
continue
if any(x == y for x, y in zip(string[1:], string)):
count += 1
print(count)
a, b = map(int, input.split("-"))
count = 0
for i in range(a, b + 1):
string = str(i)
if list(string) != sorted(string):
continue
if any(string.count(c) == 2 for c in string):
count += 1
print(count)