In this example, I am trying to make it so that if variable == one of the values in the array, it prints "This Works".
array = [1, 2]
one = 1
two = 2
def trying():
if one == array:
print("This Works")
print(trying())
I understand that one and array isn’t the same, but how do I go about getting one and the value 1 to equal, so that this code works
>Solution :
Try with in instead of ==,
array = [1, 2]
one = 1
two = 2
def trying():
if one in array:
print("This Works")
print(trying())