Loops, General
Given list of ints, return True if any two nums in list sum to 0.
>>> add_to_zero([])
False
>>> add_to_zero([1])
False
>>> add_to_zero([1, 2, 3])
False
>>> add_to_zero([1, 2, 3, -2])
True
Given the wording of our problem, a zero in the list will always make this true, since “any two numbers” could include that same zero for both numbers, and they sum to zero:
>>> add_to_zero([0, 1, 2])
True
We’ve given you addtozero.py, which has an add_to_zero function:
def add_to_zero(nums):
"""Given list of ints, return True if any two nums sum to 0."""
This function isn’t implemented, though, so when we run addtozero.py, we have test failures.