def find_sequences(lst, min_len=3):
    asc, desc = [], []
for i in lst:
    if not asc or i >= asc[-1]:
        asc.append(i)
else:
    if len(asc) >= min_len:
        yield asc
asc = [i]
if not desc or i <= desc[-1]:
    desc.append(i)
elif len(desc) >= min_len:
    yield desc
desc = [i]
if len(desc) >= min_len:
    yield desc
if len(asc) >= min_len:
    yield asc
Determining where in a list ascending or descending stops