input: Write a function to compress a given data sequence by grouping consecutive numbers with the same sign. The function should return a list of lists where each sublist contains numbers with the same sign. If the given sequence is empty then return an empty list.
  
  def compress_sequence(nums):
      output = []
      temp = []
  
      for i in range(1, len(nums)):
          if nums[i-1] * nums[i] >= 0:
              temp.append(nums[i-1])
          else:
              temp.append(nums[i-1])
              output.append(temp)
              temp = []
      if nums:
          temp.append(nums[-1])
          output.append(temp)
  
      return output
  
  print(compress_sequence([9, -2, 6, 0, -7]))
  assert compress_sequence([9, -2, 6, 0, -7]) == [[9], [-2], [6, 0], [-7]]
  assert compress_sequence([]) == []
output: def compress_sequence(nums):
      output = []
      temp = []
  
      for i in range(len(nums)):
          if temp and (nums[i] * temp[-1] < 0):
              output.append(temp)
              temp = []
          temp.append(nums[i])
  
      if temp:
          output.append(temp)
  
      return output