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
check_circleMark as learned
Checking if a list is empty in Python
schedule Jul 1, 2022Last updated
tocTable of Contentsexpand_more
Check out the interactive map of data science
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?
Enjoy our search
Hit / to insta-search docs and recipes!