Sums to X
Determine the number of unique pairs of values in a given list that sum up to an inputed value. For each qualifying pair, print out the location of the two values.
def sumsToX(num,listOfValues):
sumFoundCnt = 0
outer = 0
while (outer < len(listOfValues)):
inner = outer + 1
while (inner < len(listOfValues)):
if ((listOfValues[outer]+listOfValues[inner]) == num):
sumFoundCnt = sumFoundCnt + 1
inner = inner + 1
outer = outer + 1
if (sumFoundCnt == 0):
print "No two values in the list add up to ", num
else:
print sumFoundCnt, " different pairs of numbers add up to ", num