I\'m trying to generate a sliding window function in Python. I figured out how to do it but not all inside the function. itertools, yield, and iter() are entirely new to me
I don't know what your input or expected output are, but you cannot mix yield and return in one function. change return to yield and your function will not throw that error again.
def window(fseq, window_size=5):
....
final.append(tentative_string)
yield final