def aa(nums,s): i=0 leng=len(nums) ret=[] while i<leng-s+1: ret.append(max(nums[i:i+s])) i +=1 return ret print(aa([2,3,4,2,6,2,5,1],3))