A sub list is a list that is part of a larger list. A sub list may be a list containing a single element, multiple elements, or even no elements at all. For example, [1], [2], [3] and [4] are all sub...


A sub list is a list that is part of a larger list. A sub list may be a list containing a single element, multiple elements, or even no elements at all. For example, [1], [2], [3] and [4] are all sub lists of [1, 2, 3, 4]. The list [2, 3] is also a sub list of [1, 2, 3, 4], but [2, 4] is not a sub list [1, 2, 3, 4] because the elements 2 and 4 are not adjacent in the longer list. The empty list is a sub list of any list. As a result, [] is a sub list of [1, 2, 3, 4]. A list is a sub list of itself, meaning that [1, 2, 3, 4] is also a sub list of [1, 2, 3, 4]. In this exercise you will create a function, is Sub list, that determines whether or not one list is a sub list of another. Your function should take two lists, larger and smaller, as its only parameters. It should return True if and only if smaller is a sub list of larger. Write a main program that demonstrates your function.




May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here