Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- max_value = 1000
- def calculate_parent_value(n):
- if n == 1000:
- return -999
- elif n == -1000:
- return 999
- elif n == 0:
- return 0
- else:
- return -(1 - 2*((abs(n) - 1) % 2)) * (abs(n) - 1)
- for i in range(990,1001):
- print(calculate_parent_value(i))
- print(calculate_parent_value(0))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement