init day00 python
This commit is contained in:
commit
dd834665e5
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
**/input.txt
|
1
2023/day01/python/run.sh
Executable file
1
2023/day01/python/run.sh
Executable file
@ -0,0 +1 @@
|
|||||||
|
python3 main.py
|
15
2023/day01/python/src/main.py
Normal file
15
2023/day01/python/src/main.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
text: str = open("input.txt", "r").read()
|
||||||
|
|
||||||
|
import string
|
||||||
|
|
||||||
|
value: int = 0
|
||||||
|
|
||||||
|
for line in text.split("\n"):
|
||||||
|
for index, chars in enumerate([line[::-1], line]):
|
||||||
|
for char in chars:
|
||||||
|
if (char in string.digits):
|
||||||
|
value += int(char) * 10 ** index
|
||||||
|
print(value)
|
||||||
|
break;
|
||||||
|
|
||||||
|
print(value)
|
Loading…
Reference in New Issue
Block a user