r/programmingrequests • u/Environmental-Way762 • Feb 04 '22
Solved✔️ Permutation with added rules
Hi everyone,
I have no real experience with coding and after spending some horrific hours trying to understand permutations in python I gave up.
So basically I need to know all the different combinations of ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D'], but the sequences need to adhere to some rules though which are the following:
A has to always be followed by either A or B
B has to always be followed by either C or D
C has to always be followed by C or D
D has to always be followed by either A or B
Now I am able to do the permutation for the strings, but I do not know how to add the rules to the permutation.
Would anyone be able to help me with this?
Thanks in advance!
View all comments
Show parent comment
1
u/Environmental-Way762 Feb 07 '22
Alright, it seems a lot more complicated than I thought haha. Thank you for helping, I think it's best if I'll look at other ways to solve the problem. Thank you again!