Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calculate_1(X):
- Y = set()
- delta = set()
- for x in X:
- if x < -39 or x >= 43:
- Y.add(abs(x))
- if -8 < x <= 81:
- delta.add(x)
- return Y, delta, sum(Y)
- def calculate_2(Y, delta):
- I_ = set()
- absolute_sum_I = 0
- for b in delta:
- for v in Y:
- if b >= v:
- I_.add(b * v)
- for i in I_:
- absolute_sum_I += abs(i)
- return absolute_sum_I
- def main(T):
- Y, delta, absolute_sum_Y = calculate_1(T)
- absolute_sum_I = calculate_2(Y, delta)
- return absolute_sum_I + absolute_sum_Y
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement