27. Problem to check whether a list contains a sublist or not.

In this program, we will take two lists as inputs and check whether the list contains a sublist with the help of the below-given steps.

List contains a sublist:

Steps to solve the program
  1. Take two lists as input.
  2. Check whether list2 is a sublist of list1 (i.e. all the elements from the list2 are in list1.
  3. Use for loop for this purpose.
  4. Print the output.

Output :

Related Articles

Find the max, min, and sum of the list

Generate all sublists with 5 or more elements

Leave a Comment