Answers for "ptyhonn check if set empty"

1

how to check a set is empty in python

s = set()
if len(s) == 0:
  print('Empty')
else:
  print('Not empty')
Posted by: Guest on June-06-2021
0

check if value is empty python

a_variable = {}

is_a_empty = bool(a_variable)

print(is_a_empty)
# >>> False


b_variable = [1, 2, 3]

is_b_empty = bool(b_variable)

print(is_b_empty)
# >>> True
Posted by: Guest on June-09-2021

Python Answers by Framework

Browse Popular Code Answers by Language