Accessing an item in a listAdding items to a listChecking if a list is emptyChecking whether a value is in a listConcatenating two listsCopying a list in PythonDifference between append and extend methodsDifference between sort and sortedFinding the index of an element in a listFinding the length of a listIterating from index oneLooping through listsModifying listsPrinting a list in reverse orderRemoving items from a listSorting a listUsing enumerate and zip at the same time
Checking if a list is empty in Python
schedule Mar 10, 2022Last updated
tocTable of Contentsexpand_more
We can check if a list is empty in Python using the
To check whether list
a is empty:
a = if not a:print("List is empty")List is empty
a is empty,
not a is
"List is empty" is printed.
Published by Isshin Inada
Edited by 0 others
Did you find this page useful?