# Zero sum in python 2.7 [closed]

Write a function in Python 2.7 that takes a list of integers as an argument. It should return True or False depending on whether there are any 2 integers in the argument list that sum to zero. [4,-4,9,6,5]

True

[6,5,-3,2]

False

## closed as off-topic by Arnauld, dzaima, fəˈnɛtɪk, Pavel, Luis MendoMay 28 '18 at 18:42

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "Questions without an objective primary winning criterion are off-topic, as they make it impossible to indisputably decide which entry should win." – Arnauld, dzaima, fəˈnɛtɪk, Pavel, Luis Mendo
If this question can be reworded to fit the rules in the help center, please edit the question.

• Welcome to PPCG! That's a nice challenge, but unfortunately, we don't like challenges that allow only one language. This challenge is also missing a winning criteria. I'd recommend you to look at few other of challenges there and use our sandbox next time. – RedClover May 28 '18 at 17:56
• I'm guessing this must be code golf as I can't see any other reasonable criteria. (I added the code golf tag, but if that is wrong feel free to specify the correct winning criteria and remove it.) – Jonathan Allan May 28 '18 at 18:09
• @Arlene what should we return for [0]? – ngn May 28 '18 at 18:24
• @JonathanAllan Please stop editing programming questions to make them on-topic. Either OP edit the winning criteria in themselves or we close (and optionally someone else repost) it. – user202729 May 29 '18 at 4:05
• @user202729 I didn't think there was any harm, meta read and noted - it makes sense; thanks – Jonathan Allan May 29 '18 at 12:41

# Python 2, 32 bytes

lambda a:any(-n in a for n in a)


Try it online!

# R, 23 bytes

function(x)any(-x%in%x)


Try it online!

If full programs are allowed:

### R, 21 bytes

any((x=scan())%in%-x)


Try it online!

• Yes any language is fine. Sorry I am new to this. Thank you! – Arlene May 29 '18 at 22:06
• @Arlene Thank you and welcome to PPCG! – JayCe May 30 '18 at 0:01
• @Arlene Please edit your question to reflect the fact that all languages are allowed. Also if you are interested in the shortest solution, I suggest you tag your question code-golf – JayCe May 30 '18 at 0:04