'Subtract values in a list from the first value (Python)

I have a list of ints and i want to go through every number of the list and subtract it from the first like how a calculator would do multiple input subtraction.

myList = [3,2,1,4,5]


def subtractionDifference(n):
  start = n[0]

  for num in n[1:]:
      difference = start - num
  return difference

print(subtrationDifference(myList))

this prints -2 and ideally it would print -9



Solution 1:[1]

Try this

myList = [3,2,1,4,5]

def subtractionDifference(n):
  difference = n[0]

  for num in n[1:]:
      difference = difference - num
  return difference

print(subtrationDifference(myList))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Armann