I don't know what you mean by 'subtracting lists'. With your listSum() you implicitly start with the accumulator set to 0. What is the initial value of the accumulator for a subtraction? Or do you want to 'subtract' one list from another? As a set or each element from its matching element?
Assuming the first:
if not alist: # bad form to use keyword "list" to name a variable
heres the exact question that i am trying to solve,
write in python a recursive function "subtract" that takes as parameters two lists of integers. the list are sorted and contain no duplicates.(they represent sets) the function returns a sorted list of integers, without duplicates, representing the set-difference. for instance subtract([1,2], [2,3]) should return 1
Now, you need to do the recursive work yourself, so I'm not going to write the code. Think this way: If I know the first element in lhs is in rhs then the return value will not hold that value, otherwise it will. Depending on whether the return list holds the first element of the left list, the recursion may involve either or both lists. The base case needs a little thought too.
Edit: Notice that the problem statement does not require you to do the work in place: The returned list and each of the argument lists can be distinct; and the argument lists can remain unchanged.