Sliding Window Python Code