For example, given a list:
binary = [] #only 0, 1 allowed
Now I put it in a loop which append 0, 1 value randomly using randint.
1st loop:
binary = [1]
2nd loop:
binary = [1, 1]
Now, if the third the random number also return 1 which is:
binary = [1, 1, 1] # not allowed
but this case is ok:
binary = [1, 1, 0, 1] #ok
The point is, I want to prevent continuously duplication in a list, where [1, 1, 1] is not allowed. How can I do it?