So I am working on a script for numerical one time pads but the issue is that I would like the result of the sums to stay within a specific range of 0 to 10 so that
2-4=9 [9, 10, 0, 1, 2]
4-9=6 [6, 7, 8, 9, 10, 0, 1, 2, 3, 4]
7+8=4 [7, 8, 9, 10, 0, 1, 2, 3, 4]
Here is my script
#list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
#sum = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0] 1 = addition, 0 = subtraction
#of = [2, 4, 3, 9, 5, 6, 8, 7, 0, 1,]
length = len(list)
i = 0
while i < length:
x = list[i]
s = sum[i]
y = of[i]
if s == 1:
z = x + y
else:
z = x - y
print(z)
i += 1