I have the following list and variable:
x = [1,2,17,4,5,7,11]
v = 18
and I want (in a single if
statement) to search in the list to check if it contains an item that if we subtract "or any other operation" it from v variable will equal to one "as example".
For the above example, the if
statement will yield True since we have the item 18 (18-17=1).
Can we do that in a single if statement (without using a separate loop) with python ?