I\'m new to programming and I\'m trying to do the codingbat.com problems to start. I came across this problem:
Given an array calculate the sum except when there is
def skipAndAddFun(inputVal, skipList): sum = 0 for i in inputVal: if not i in skipList: sum += i return sum
Usage:
skipAndAddFun([1,2,13,5,1], [13, 5]) 4
This simple function will be a generic solution for your question.