title: Possible binary numbers function Python
body: <p>I am trying to write a function that does this: <strong>returns all the binary numbers with N digits, and in sorted order. Each binary number is represented as a tuple. The result of calling AllBinary(N) is a tuple containing 2^N binary numbers.</strong> Example:</p>
  
  <pre><code>AllBinary(2)
  [(0, 0), (0, 1), (1, 0), (1, 1)]
  </code></pre>
  
  <p>I am trying to write the function using either a for or while loop. This is my code:</p>
  
  <pre><code>def AllBinary(N):
      c =[]
      for i in range(2**N):
  </code></pre>
  
  <p>I think I can solve it using an accumulation for loop by having the loop create the tuples of binary and then add them to the empty list c. But I am not sure how I am going to code the loop to get me those binary tuples.</p>