This commit is contained in:
2025-12-02 20:58:26 +01:00
parent 27942825a4
commit 1f1ad1dfe5
3 changed files with 29 additions and 0 deletions

27
02/02-1.py Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#file = "./ex.txt"
file = "./input.txt"
if __name__ == "__main__":
solution = 0
input_file = open(file, "r")
for line in input_file:
line = line.strip()
if line == "":
continue
range_list = line.split(",")
for r in range_list:
a,b = r.split("-")
for i in range(int(a),int(b)+1):
i_str = str(i)
l = len(i_str)
l_half = l // 2
if l % 2 != 0:
continue
elif i_str[:l_half] == i_str[l_half:]:
print(i)
solution += i
print(f"The Password is: {solution}")