Is there a simpler way to achieve this with list comprehensions? I’m new to them and currently trying to improve my coding:
list = []
for k in range(1000):
if k != num1 and k != num2:
listToFade.append(k)
basically in ‘list’ you have all the numbers from 0 to 999 except 2
Thanks!
>Solution :
Here is a list comprehension version of your code:
list=[i for i in range(1000) if i not in [num1, num2]]