Add 2021-1
This commit is contained in:
commit
7aa8eaec32
2 changed files with 2020 additions and 0 deletions
20
1/solution.py
Executable file
20
1/solution.py
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
def get_positive_changes(values):
|
||||||
|
count = 0
|
||||||
|
|
||||||
|
for i in range(1, len(values)):
|
||||||
|
if int(values[i - 1]) < int(values[i]):
|
||||||
|
count += 1
|
||||||
|
return count
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
f = open("input", "r")
|
||||||
|
values = f.readlines()
|
||||||
|
print('1. solution:', get_positive_changes(values))
|
||||||
|
|
||||||
|
new_values = []
|
||||||
|
for i in range(2, len(values)):
|
||||||
|
new_values.append(int(values[i]) + int(values[i-1]) + int(values[i-2]))
|
||||||
|
|
||||||
|
print('2. solution:', get_positive_changes(new_values))
|
Loading…
Reference in a new issue