List of binary numbers: How many positions have a one and zero
I only see a few micro optimisations:

Iterate the list instead of a range, so that you don't have to do another lookup with list[i+1]
Use more assignment operators, such as &amp;=, |= and &gt;&gt;=
It is not needed to use lst[1] in andnumber = lst[0] &amp; lst[1]. It can be just andnumber = lst[0]

So:
def count_mixed_bits_v2(lst):
    andnumber = ornumber = lst[0]
    for value in lst:
        andnumber &amp;= value
        ornumber |= value
    xornumber = andnumber ^ ornumber
    result = 0
    while xornumber &gt; 0:
       result += xornumber &amp; 1
       xornumber &gt;&gt;= 1
    return result

This visits the first list value again (in the first iteration), even though it is not necessary. But that probably does not really hurt performance, and keeps the code simple.