Is there a way for python to check multiple values for "not equals to"? Like:
if len(dict) != 2 or 4 or 8 or 16 or 32:
do_something()
Is there a way for python to check multiple values for "not equals to"? Like:
if len(dict) != 2 or 4 or 8 or 16 or 32:
do_something()
Use a set
:
if len(dict) not in {2, 4, 8, 16, 32}:
do_something()