0

Is there a difference between these two lines in how they work??

if not i in lst

vs

if i not in lst
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
xSabotagex
  • 93
  • 7
  • 5
    Does this answer your question? [If loop: "x not in" vs. "not x in"](https://stackoverflow.com/questions/3481554/if-loop-x-not-in-vs-not-x-in) – Pani May 24 '20 at 21:27
  • From [the docs](https://docs.python.org/3/reference/expressions.html#membership-test-operations): "*`x not in s` returns the negation of `x in s`*" So that basically says that `x not in s === not (x in s)` – Tomerikoo May 24 '20 at 21:30
  • Does this answer your question? ["x not in y" or "not x in y"](https://stackoverflow.com/questions/8738388/x-not-in-y-or-not-x-in-y) – revliscano May 24 '20 at 21:30

0 Answers0