How to call a value that does not equal X as integer : I have an array of numbers:

    array = [1,2,3]

and would like to call a random integer, k, that does not equal x

I've tried:

    x = 2
    k = (i for i in array if i !=x)

but this returns a generator object instead of an integer. Is there a way to fix this?

Thanks in advance!