List all possible iterations - Optimize code

  • Hi,


    I want to optimize my code to list alll possible iterations of an input based of None, 0 and 1 where None is either 0 or 1.


    I have a dirty trick with a random function to generate 0 or 1, but I would like to code the cleaner version that takes the least possible loops to get to the solution.


    Do you have any ideas how to optimize this code?

    Thanks