Function to check if dictionary value is occupied

Solution 1:

The issue is in the way you referenced the value of the 'key'. Use this:

XO = {'key': []}
def check_values(input_v):
    value = input_v
    global XO
    #print(XO)
    if value in XO['key']:
        print("Occupied")
    else:
        XO['key'].append(value)
    #print(XO)