I have a list for exemple:
a = [ 9,6,5,4,1,0,0,7,6] .
By this function I want to delete all element which content zero and delete all element which content duplicate.
But it doesn’t do exact what I want.

def rensa(a,b):
    for i in a:
        if a[j]<= 0:
            del a[j]
        elif a[j]==a[j+1]:
            del a[j+1]
        print a
    return a,b

The easiest way would probably be to create a new list ('b', perhaps? You've defined 'b' in your function but never use it). Then copy each item from 'a' to 'b' unless it is 0 or already in 'b'.

How do you mean when I copy from a to b delete zero and duplicate?

Create a new list called 'b'. Then pass through list 'a', and check each element against list 'b'. Use the 'append' method to add to list 'b' if you need to.

And for what it's worth, I probably would use more meaningful variable names than 'a' and 'b'.
Here's some code.

old_list = [ 9,6,5,4,1,0,0,7,6]
new_list = []
for item in old_list:
    if item != 0:
        if item not in new_list:
print old_list
print new_list

[9, 6, 5, 4, 1, 0, 0, 7, 6]
[9, 6, 5, 4, 1, 7]

Thank you very much for your help, but I work with the same list many time if there are more zero and duplicate the program must delete them.
I mean for example if I have a list 4.4.2 the program take minus one from every element then put it in a new element like that.

This question has already been answered. Start a new discussion instead.