Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

For example, if passed the following:

a = []

How do I check to see if a is empty?

1 Answer

0 votes
by (106k 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.6k 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.6k points)

Browse Categories

...