Answer the question
In order to leave comments, you need to log in
Execute if variable equals at least one element from array (Python)?
Let's say that the id variable gets the identifier of the user who wrote the message.
Let's say the array is user = ["334455", "556677"]
How do I do this? If at least one element from the array is equal to the variable then: ...
I tried this, but it didn't work:
if id == user[0] or user[1]:
if user[0] or user[1] in id:
Answer the question
In order to leave comments, you need to log in
if id in set(user):
#тут что-то делаем
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question