How can you display all the combinations of elements in a list?

25 Views Asked by At
art = list('ABBC')
combination = []

for i in range(3):
combination.append(art)
remove = art.pop(0)
art.append(remove)

Currently breaking down the problem and trying to do using .pop(): ABBC ABCB ACBB

However, when the loop continues and the variable art changes, it also changes the elements within the list too?

So i would want the output to be:

ABBC

ABCB

ACBB

BABC

BACB

BBAC

BBCA

BCAB

BCBA

CABB

CBAB

CBBA

ABBC

And i would like to achieve this without a library?

0

There are 0 best solutions below