Python Lists Append True Boolean
<p>The following [incomplete] code is designed to take in an <em>n</em> to <em>x</em> number, of length <em>x-n</em>, and return the value of the next pandigital number. The code identifies which number between <em>n</em> and <em>x</em> is missing from the number passed in as an argument to the function, and returns (for the time being, until the function is further developed), two lists, the original number itself with its individual digits as members of a list, and a list, with the numbers <em>n</em> to <em>x</em> as members, with those numbers which are present in the original number of length <em>x-n</em> being replaced by the Boolean value <em>True</em>.</p>

<pre><code>def nextPandigital(n,lower,upper):
    digits = []
    requiredDigits = []

    #Completed loop
    for digit in str(n):
    digits.append(int(digit))

    #Completed loop
    for num in range(lower,upper+1):
    requiredDigits.append(num)

    for number in requiredDigits:
        if str(number) in str(digits):
            x = requiredDigits.index(number)
            #requiredDigits[x] = 'True'
            requiredDigits[x] = True
    return digits, requiredDigits
</code></pre>

<p>Although, for the input parameters of <em><code>nextPandigital(1023456789,0,9)</code></em> in Enthought Canopy, the second list returned should read <em><code>[True,True,True,True,True,True,True,True,True,True]</code></em>, the value of the second list returned is, in fact <em><code>[True,1,True,True,True,True,True,True,True,True]</code></em>, with the 1 from the original <em><code>requiredDigits</code></em> list not being replaced by <em><code>True</code></em>.</p>

<p>I know that there is no issue with the loop, or the general flow of the code, for when the <em><code>requiredDigits[x] = True</code></em> line of code is commented, and the currently commented code is uncommented, the code works as it is intended to, with all digits in <em><code>requiredDigits</code></em> being replaced by the String value '<code>True.</code>'</p>

<p>I have attempted to resolve this issue. However, I am not able to pinpoint its source. I have considered to fact that <em><code>True == 1</code></em> returns True. However, when the value True is replaced by False, in the line <em><code>requiredDigits[x] = True</code></em>, the code still works as it is intended to.</p>

<p><strong>Any answer/help/suggestion/advice on this matter would be highly appreciated. Thank you in advance.</strong></p>