[ create a new paste ] login | about

Link: http://codepad.org/EmdZZEBk    [ raw code | output | fork ]

Python, pasted on Oct 15:
1
2
3
4
5
6
7
8
def negate(a) :
  return [x for x in a if -x in a]

a = set()
a.add(1)
a.add(2)
a.add(-1)
print negate(a)


Output:
1
[1, -1]


Create a new paste based on this one


Comments: