Add code part 1 in Python
This commit is contained in:
parent
7c6755b88b
commit
eb59781112
1 changed files with 13 additions and 0 deletions
13
day_01/python/part_1.py
Normal file
13
day_01/python/part_1.py
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
increasing = 0
|
||||||
|
|
||||||
|
|
||||||
|
with open("../input", "r") as file:
|
||||||
|
data = file.read().split("\n")
|
||||||
|
|
||||||
|
for i in range(1, len(data)):
|
||||||
|
delta = int(data[i - 1]) - int(data[i])
|
||||||
|
|
||||||
|
if delta < 0:
|
||||||
|
increasing += 1
|
||||||
|
|
||||||
|
print(f"The ocean floor has increased {increasing} times")
|
||||||
Loading…
Add table
Add a link
Reference in a new issue