How to remove elements from list when each character is identical (Python)?
<pre><code>sample = ['AAAA','ABCB','CCCC','DDEF']
</code></pre>

<p>I need to eliminate all elements where every character is identical to itself in the element eg. AAAAA,CCCCC</p>

<pre><code>output = ['ABCB','DDEF']

sample1 =[]
for i in sample:
    for j in i:
       if j == j+1:    #This needs to be corrected to if all elements in i identical to each other i.e. if all "j's" are the same
        sample1.pop(i)
</code></pre>

<p>print sample</p>

<pre><code> sample = ['AAAA','ABCB','CCCC','DDEF']
 output = [sublist for sublist in sample if len(set(sublist)) &gt; 1]
</code></pre>

<h1>EDIT to answer comment.</h1>

<pre><code>sample = [['CGG', 'ATT'], ['ATT', 'CCC']]
output = []
for sublist in sample:
    if all([len(set(each)) &gt; 1 for each in sublist]):
        output.append(sublist)

# List comprehension (doing the same job as the code above)
output2 = [sublist for sublist in sample if 
           all((len(set(each)) &gt; 1 for each in sublist))]
</code></pre>

python for-loop