listA = ["A","B","C","D"]
["A","B","C"]
["B","C","D"]
["C","D","A"]
["D","A","B"]
another way to do this - brute force,
def permutation(L):
for i in range(len(L)):
x = L[i:i+3]
length = len(x)
if length != 3:
x = x + L[:3-length]
print(x)
L = ["A","B","C","D"]
permutation(L)