Q:

Write a Python program to count number of lists in a given list of lists

0

Write a Python program to count number of lists in a given list of lists.

All Answers

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

def count_list(input_list): 
    return len(input_list) 
      
list1 = [[1, 3], [5, 7], [9, 11], [13, 15, 17]] 
list2 = [[2, 4], [[6,8], [4,5,8]], [10, 12, 14]]   
print("Original list:")
print(list1)
print("\nNumber of lists in said list of lists:")
print(count_list(list1))
print("\nOriginal list:")
print(list2)
print("\nNumber of lists in said list of lists:")
print(count_list(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