
Problem –
You want to know if a list is empty or not.
Solution –
To check if a list is empty you can write
In [1]: x = []
In [2]: if not x:
...: print('List is empty')
...:
List is empty
or you can write
In [3]: x = []
In [4]: if len(x) == 0:
...: print('List is empty')
...:
List is empty