Q:

Count list/tuple elements which are different than variable?

I have list or/and tuple:
MyVar = [0,0,0,0,1,0,0,0,0]

And I want to count elements in this which are different from 0.
How to do that?

A:

No need to generate lists, just:
len(MyVar) - MyVar.count(0)

A:

Get the length of the sublist of all elements that are not 0
MyVar = [0,0,0,0,1,0,0,0,0]
len([x for x in MyVar if x != 0])
>> 1

A:

You could do a sum over a conditional generator expression which doesn't require any intermediate lists or unnecessary arithmetic operations:
>>> sum(1 for element in MyVar if element != 0)
1

or as pointed out by @Jean-François Fabre:
>>> sum(1 for element in MyVar if element)
1

In case the MyVar only contains numbers this counts the number of not-zero values.

