Write a Python function to remove all consecutive duplicates of a given number.
[1,1,2,3,3,3,4,4,4,4]
def remove_duplicates(lst):
  result = []
  curr = lst[0]

  for num in lst:
    if num != curr:
      result.append(num)
      curr = num
  return result