From 0bf172a5d83a1a53dfd0af3794f3c6bf01c4337b Mon Sep 17 00:00:00 2001 From: Paul Maier Date: Fri, 10 Dec 2021 11:49:07 +0100 Subject: [PATCH] solved 1st puzzle for day 1 --- Day01/day01.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Day01/day01.py b/Day01/day01.py index be48a77..0a31218 100644 --- a/Day01/day01.py +++ b/Day01/day01.py @@ -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)