I'm trying to implement the following substractor circuit in python:

And below is my code for it:
def AND(a, b):
return a and b
def XOR(a, b):
return a ^ b
def OR(a, b):
return (a or b)
def full_adder(a, b, c):
output = {
# sum = a ⊕ b ⊕ c
'sum' : XOR(XOR(a,b), c),
# carry = ab + (a⊕b)c
'carry' : OR(AND(a,b), AND(XOR(a, b), c))
}
return output
def n_bit_binary_substractor(a, b, n):
result = [0] * n
k = 1 # k=1 --> substraction; K=0 --> addition
carry = k
for i in range(n-1, -1, -1):
full_adder_output = full_adder(XOR(b[i], k), a[i], carry)
result[i] = full_adder_output['sum']
carry = full_adder_output['carry']
output = {
'difference' : result, # x - y
'carry_out': carry
}
return output
# Declaring input bits
a = [0, 1, 0]
b = [0, 1 ,1]
# Declaring the no. of bits for our substractor circuit
no_of_bits = 3
# Performing binary substraction
output = n_bit_binary_substractor(a, b, no_of_bits)
print(output) # result: {'difference': [1, 1, 1], 'carry_out': 0}
# carry out is expected to be 1
According to this article:
Substracting '011' from '010' should output '111' with carry 1.
But my code ended up outputting carry '0', while the difference is same as that of the expected output.
Which part of the code is causing this problem?