Question: Python Programming Problem 4a contain.py: Partial equality [5 points] Write a function contains_at() that accepts two lists, l and s, and an integer i and
Python Programming
Problem 4a contain.py: Partial equality [5 points] Write a function contains_at() that accepts two lists, l and s, and an integer i and returns True if and only if the sub-list of l starting a index i and ending at index i+len(s)-1 is equal to s. The lists should not be modified in any way.
Practice goal: List slices and list equality. Also, together with problem 4b, further practice in modular thinking and programming.
Problem 4b contain.py: Sub-lists [10 points] Write a function contains() that accepts two lists, l and s, and returns True if and only if l contains s at any valid position (i.e., any position 0 ? i < len(`)). The lists should not be modified in any way.
For full credit, your solution must re-use the function contains_at() at you wrote before (even if you wrote it as a one-liner).
Practice goal: Another accumulation pattern, with boolean and, to evaluate a for all expression.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
