I have created a function that takes a list of integers and subtracts from left to right to return the final answer. I am not keen on using a count variable to skip through the first loop as it seems wasteful - Is there a better way of doing this in Python?
def subtract(numlist):
''' numlist -> int
Takes a list of numbers and subtracts from left to right
'''
answer = numlist[0]
count = 0
for n in numlist:
if count != 0:
answer -= n
count += 1
return answer
print(subtract([10,2,4,1]))