dimanche 8 mars 2020

Check if any element in list is empty/'not a number' (Python)

I want to use an if-statement that checks if a list contains an empty element. A line that does something like this:

list1 = [1,2,[],2]
list2 = [1,2,1,2]

>>>list1 'contains empty element'
True

>>>list2 'contains empty element'
False

I'm very concerned with run time.

Thanks a lot for any help!

Aucun commentaire:

Enregistrer un commentaire