From 9d7269d32f34efadde10e5f9a9a47406b2fca49c Mon Sep 17 00:00:00 2001 From: Paul Maier Date: Fri, 10 Dec 2021 11:56:51 +0100 Subject: [PATCH] cleaned up solution --- Day01/day01.py | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/Day01/day01.py b/Day01/day01.py index 0a31218..e981639 100644 --- a/Day01/day01.py +++ b/Day01/day01.py @@ -1,16 +1,25 @@ #!/usr/bin/env python3 - -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) +def day01Part1(): + 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') + pass + previous=item + + print('Part1: Number of increases: ', counter) + +def day01Part2(): + print('hello') + + +if __name__=='__main__': + day01Part1() + day01Part2()