if b(list) = 0;
print('empty');
I want to make it to find out if the list is empty but this not working, I am too new for this. what can I do if I want to know if the list is empty?
if b(list) = 0;
print('empty');
I want to make it to find out if the list is empty but this not working, I am too new for this. what can I do if I want to know if the list is empty?
Here
list_test=[]
if list_test==[]: #== Since an empty list is potrayed as [], it check if the list is []
print("List is empty.")
else:
print("List is not empty.")
To check if a list is empty you can use a if check. I am assuming that your empty list is called empty_list
empty_list = []
if not empty_list:
print('list is empty')
else:
print('List contains data')