01. Example
Using len() function.
def checkEmptyList(lst): if len(lst)==0: print('Empty List.') else: print('Not Empty List') list01=[] checkEmptyList(list01)
Output:
Empty List.
02. Example
Using bool() function.
def checkEmptyList(lst): if bool(lst): print('Not Empty List.') else: print('Empty List') list01=[] checkEmptyList(list01)
Output:
Empty List.
03. Example
Direct method: here empty list work as False value in and as True when list list have atleast on element.
list01=[] if list01: print('Non Empty List.') else: print('Empty List.')
Output:
Empty List.