Day 1 2023
This commit is contained in:
12
2023/Day-01/day01-1.py
Executable file
12
2023/Day-01/day01-1.py
Executable 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()
|
Reference in New Issue
Block a user