To count the number of increases in depth, this function iterates over the given input and checks to see if the previous number was smaller than the current one. If so, the counter gets incremented. At the end, the value of the counter is printed which refers to the total number of times that the depth measurement increased.
def day1():
input_file = open("day1/day1-input")
lines = input_file.readlines()
counter = 0
for index, line in enumerate(lines):
if index != 0:
if (int(line) - int(lines[index - 1])) > 0:
counter += 1
print(counter)