Skip to content

Instantly share code, notes, and snippets.

@mohankumargupta
Created July 9, 2016 10:43
Show Gist options
  • Save mohankumargupta/d9e4dfcf3aba3faa75ffa04b7702d694 to your computer and use it in GitHub Desktop.
Save mohankumargupta/d9e4dfcf3aba3faa75ffa04b7702d694 to your computer and use it in GitHub Desktop.
from functools import reduce
mylist = [
(0,0),
(0,0),
(5, 5),
(10,10),
(10,10),
(-2,-3),
(0,0)
]
def func(value, element):
if element in value:
return value
else:
return value + [element]
boo = reduce(func, mylist, [])
print(boo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment