Question: I am trying to write a function that returns `True` if the elements in `lst1` appear in `lst2` in the same order as they appear in `lst1`, but not necessarily consecutively.

For example,

`test([29, 5, 100], [20, 29, 30, 50, 5, 100])` should return `True`.

`test([25, 65, 40], [40, 25, 30, 65, 1, 100])` should return `False`.

Here is what I have so far:

```
def test(lst1, lst2):
    for i in range(len(lst1)-len(lst2)+1):
        if lst2 == lst1[i:i+len(lst2)]:
            return True 
    return False 

```

Answer: 
This scans the lists and is a different approach:

```
def test(lst1, lst2):
    p2 = 0
    length = len(lst2)
    for e1 in lst1:
        for p in range(p2, length):
            if e1 == lst2[p]:
                p2 = p
                break
        else:
            return False    
    return True

```

For each element in `lst1` it searches the subset of list 2 (between `p2` and the end) for it. If it is found, it restricts the range following searches by updating `p2`. If it is not found, `False` is returned. `True` is returned if every element in `lst1` is found.
```
def test(lst1, lst2):
    for x in lst2:
        if x == lst1[0]:
            del lst1[0]
    return lst1 == []

```

Should work.