@@ -0,0 +1,1772 @@
+#!/Applications/anaconda/envs/Python3/bin%0A%0A%0Adef main():%0A    # Test suite%0A    tests = %5B%0A        %5BNone, None, None%5D, # Should throw a TypeError%0A        %5B%5B1, 2%5D, 7.89, None%5D, # Should throw a TypeError%0A        %5B%5B%5D, 7, None%5D, # Should throw a ValueError%0A        %5B%5B1, 3, 2, -7, 5%5D, 7, %5B2, 4%5D%5D%0A    %5D%0A%0A    for item in tests:%0A        try:%0A            temp_result = two_sum(item%5B0%5D, item%5B1%5D)%0A            if temp_result%5B0%5D == item%5B2%5D%5B0%5D and temp_result%5B1%5D == item%5B2%5D%5B1%5D:%0A                print('PASSED: two_sum(%7B%7D, %7B%7D) returned %7B%7D'.format(item%5B0%5D, item%5B1%5D, temp_result))%0A            else:%0A                print('FAILED: two_sum(%7B%7D, %7B%7D) returned %7B%7D, should have returned %7B%7D'.format(item%5B0%5D, item%5B1%5D, temp_result, item%5B2%5D))%0A%0A        except TypeError:%0A            print('PASSED TypeError test')%0A%0A        except ValueError:%0A            print('PASSED ValueError test')%0A%0A    return 0%0A%0Adef two_sum(nums, val):%0A    '''%0A    Given an array of ints, find indices of two numbers that sum to val%0A    Input: nums (array), val (int)%0A    Output: list with two indices of numbers in nums that sum to val%0A    Assumes nums is not sorted, returns an empty list if no answer%0A    '''%0A    if type(nums) is not list or type(val) is not int:%0A        raise TypeError('Input must be an array and an integer')%0A%0A    if not nums:%0A        raise ValueError('First argument must be a non-empty array')%0A%0A    complements = dict()%0A%0A    for i, num in enumerate(nums):%0A        complement = val - num%0A        if num in complements.keys():%0A            # Found the complement in dict that matches with current number%0A            return %5Bcomplements%5Bnum%5D, i%5D%0A        else:%0A            # No match, save complement and index to dict%0A            complements%5Bcomplement%5D = i%0A    return %5B%5D%0A%0A%0Aif __name__ == '__main__':%0A    main()%0A

Add findSumInArray problem and tests