For example, if passed the following:
JavaScript
x
2
1
a = []
2
How do I check to see if a
is empty?
Advertisement
Answer
JavaScript
1
3
1
if not a:
2
print("List is empty")
3
Using the implicit booleanness of the empty list
is quite Pythonic.