From cc5ca7ed875ff80a61297b9981df61fd84c215bf Mon Sep 17 00:00:00 2001 From: Mudith Daga Date: Sat, 16 Jul 2022 22:57:47 +0530 Subject: [PATCH] Update files --- 2020/4.py | 2 +- 2020/5.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 2020/5.py diff --git a/2020/4.py b/2020/4.py index ee1d729..10584d5 100644 --- a/2020/4.py +++ b/2020/4.py @@ -1,7 +1,7 @@ # If you already have the data as an input use: data = [] # Your Advent Input # However, it is highly recommended to run this: -location = "C:\\Users\\dagam\\Downloads\\input.txt" # Path of the input.txt provided from Advent Calendar +location = "" # Path of the input.txt provided from Advent Calendar try: with open(location,'r') as f: data = (''.join(f.readlines())).split('\n\n') diff --git a/2020/5.py b/2020/5.py new file mode 100644 index 0000000..69f9d49 --- /dev/null +++ b/2020/5.py @@ -0,0 +1,13 @@ +# If you already have the data as an input use: +data = [] # Your Advent Input +# However, it is highly recommended to run this: +location = "" # Path of the input.txt provided from Advent Calendar +try: + with open(location,'r') as f: + data = f.readlines() + f.close() +except: + pass +data = [o.rstrip('\n') for o in data] +if data[-1] == "'+": + del data[-1] \ No newline at end of file