day 3-2
This commit is contained in:
20
03/03-2.py
20
03/03-2.py
@@ -1,22 +1,20 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
file = "./ex.txt"
|
#file = "./ex.txt"
|
||||||
#file = "./input.txt"
|
file = "./input.txt"
|
||||||
|
|
||||||
def find_num(l:str) -> int:
|
def find_num(l:str) -> int:
|
||||||
numbers = "9876543210"
|
numbers = "9876543210"
|
||||||
nums = []
|
nums = []
|
||||||
pos = 0
|
pos = 0
|
||||||
for zell in range(1,12):
|
for zell in range(0,13):
|
||||||
|
while zell > len(nums):
|
||||||
for n in numbers:
|
for n in numbers:
|
||||||
if zell < len(nums):
|
for i in range(pos, len(l)-12+zell):
|
||||||
continue
|
if n == l[i] and zell > len(nums):
|
||||||
for i in range(pos, len(l)-11+zell):
|
pos = i+1
|
||||||
if n == l[i]:
|
nums.append(n)
|
||||||
pos = i+1
|
|
||||||
nums.append(n)
|
|
||||||
print("".join(nums))
|
print("".join(nums))
|
||||||
return int("".join(nums))
|
return int("".join(nums))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user