solved 1st puzzle for day 1

This commit is contained in:
Paul Maier 2021-12-10 11:49:07 +01:00
parent 72a23bb29f
commit 0bf172a5d8

View File

@ -1,3 +1,16 @@
#!/usr/bin/env python3
print ("hello")
with open("data/input.txt","r") as f:
myInput=f.read().splitlines()
counter=0
previous=int(myInput[0])
for item in myInput[1:]:
if int(item) > int(previous):
print(previous, item, 'Increased')
counter=counter+1
if int(item) < int(previous):
print(previous, item,'decreased')
previous=item
print('Number of increases: ', counter)