How about
def contigious_subarrays(A:list): for i in range(len(A)): temp=[] for ii in range(i,len(A)): temp.append(A[ii]) print(temp)