if not list python code example
Example 1: how to tell if a list is empty in python
if not a:
print("List is empty")
Example 2: python not in list
>>> 3 not in [2, 3, 4]
False
>>> 3 not in [4, 5, 6]
True
if not a:
print("List is empty")
>>> 3 not in [2, 3, 4]
False
>>> 3 not in [4, 5, 6]
True