Question: a. Write a function to check if list1 is sub list of list2, a sub list is a part of a larger list, all
a. Write a function to check if list1 is sub list of list2, a sub list is a part of a larger list, all elements are same and they keep in the same order. For example list [1,2,3] is a sublist of [1,2,3,4], but neither [1,3] nor [1,3,2] is a sublist of [1,2,3,4]. def sublist (list1, list2): b. Write another function remove_duplicate to check each element in the list and removes all duplicated ones and keep only ONE copy of each different element. For example, if we have a list l=[a, b, a, b, b, c ], the function should remove duplicated "a" and "b", return a list ["a", "b", "c"]. Note: the function takes a list as parameter and returns a new list without duplicates. def remove_duplicate(list):
Step by Step Solution
There are 3 Steps involved in it
Below are the Python functions to achieve the specified tasks a Function to check if list1 is a subl... View full answer
Get step-by-step solutions from verified subject matter experts
