09-2a fertig
This commit is contained in:
@@ -5,10 +5,10 @@ data = [[int(i) for i in line.strip().split()]for line in input_file]
|
||||
input_file.close()
|
||||
|
||||
|
||||
def find_diff(val_list):
|
||||
def find_prev(val_list):
|
||||
if val_list.count(0) == len(val_list):
|
||||
return 0
|
||||
return val_list[0]-find_diff([(val_list[i+1]-val_list[i]) for i in range(len(val_list)-1)])
|
||||
return val_list[0]-find_prev([(val_list[i + 1] - val_list[i]) for i in range(len(val_list) - 1)])
|
||||
|
||||
|
||||
print("Lösung:", sum([find_diff(d) for d in data]))
|
||||
print("Lösung:", sum([find_prev(d) for d in data]))
|
||||
|
||||
Reference in New Issue
Block a user