input: Write a function that takes a list of integers as input and returns the maximum number in the list. If the list is empty, return 0.
  
  def max_num(nums):
      if not nums:
          return 0
      max = nums[0]
      for num in nums[1:]:
          if num > max:
              max = num
      return max
  
  assert max_num([5, 4, 2, 7, 12])==12
  assert max_num([-1, -2, -3, -4])==-1
  assert max_num([7])==7
  assert max_num([])==0
output: def max_num(nums):
      if not nums:
          return 0
      max = nums[0]
      for num in nums[1:]:
          if num > max:
              max = num
      return max