diff --git a/Day01/day01.py b/Day01/day01.py index bd4eb82..c4c6b31 100755 --- a/Day01/day01.py +++ b/Day01/day01.py @@ -17,27 +17,20 @@ def day01Part1(): print('Part1: Number of increases: ', counter) def day01Part2(): - with open("data/input.txt","r") as f: + with open("data/test.txt","r") as f: myInput=f.read().splitlines() - counter=0 - previous=999999 - - i=0 - for item in myInput: - if i < len(myInput)-2: - total=int(myInput[i])+int(myInput[i+1])+int(myInput[i+2]) - if previous < total: - print(previous, total, 'Increased') - counter=counter+1 - else: - print(previous, total,'decreased') - i=i+1 - previous=total + counter=0 + previous=int(myInput[0]) + print(type(previous)) + for i in range(len(myInput)-1): + if i < len(myInput-2): + sum=myInput[i]+myInput[i+1]+myInput[i+2] + print(sum) - print('Part2: Number of increases: :', counter) - -# if the item before is the same as the one after curent it will say no change --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh than it will say no change -# A comment + previous=int(myInput[0]) + +# if the item before is the same as the one after than it will say no change + if __name__=='__main__': day01Part1() day01Part2()