ok, I have a list of numbers and i want to return values in a range that are not in the list of numbers...

I'm thinking of something like this:

[ number for number in range(1, 10) if != nums ]

However, This always prints all the numbers in that range...
I'm not sure what else i'm missing.

Thanks

>>> l=[1, 2, 3, 4, 5]
>>> l2=[number for number in range(1, 10) if not number in l]
>>> l2
[6, 7, 8, 9]

or something like this :

>>> l3=[]
>>> for number in range(1, 10):
    #if number in l: pass
    if not number in l:
        l3.append(number) #l3 += [number]
>>> l3
[6, 7, 8, 9]

Cool, thank you. that makes sense.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.