Q:

Write a Python program to remove empty lists from a given list of lists

0

Write a Python program to remove empty lists from a given list of lists.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

list1 = [[], [], [], 'Red', 'Green', [1,2], 'Blue', [], []]
print("Original list:")
print(list1)
print("\nAfter deleting the empty lists from the said lists of lists")
list2 = [x for x in list1 if x]
print(list2)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now