0 votes
1 view
in Python by (47.8k points)

For example, if passed the following:

a = []

How do I check to see if a is empty?

1 Answer

0 votes
by (107k points)

By using the implicit booleans of the empty list are quite pythonic.

if not a:

print("List is empty")

Related questions

0 votes
1 answer
asked Sep 26, 2019 in Python by Sammy (47.8k points)
0 votes
2 answers
asked May 30, 2019 in Python by Anvi (10.2k points)
0 votes
1 answer
asked Jul 3, 2019 in Python by Sammy (47.8k points)
+2 votes
3 answers
Welcome to Intellipaat Community. Get your technical queries answered by top developers !

Categories

...