Day 1 2023

This commit is contained in:
2023-12-01 14:28:54 +00:00
parent 73c553802c
commit ddf702ff8f
2 changed files with 48 additions and 0 deletions

12
2023/Day-01/day01-1.py Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/python3
def main():
with open('input.txt', 'r') as input_file:
total = 0
for line in input_file:
digits = [char for char in line if char.isdigit()]
total += int(f'{digits[0]}{digits[-1]}')
print(total)
if __name__ == '__main__':
main()