input: Write a function to print the maximum number from a given list. The function should iterate through the list and return the maximum number.
  
  def max_num(nums):
      if not nums:
          return None
      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([5, 10, 2, 7, 12])==12
  assert max_num([5, 4, 8, 7, 12])==12
  assert max_num([5, 4, 2, 7, 2])==7
  assert max_num([])==None
output: def max_num(nums):
      if not nums:
          return None
      max = nums[0]
      for num in nums[1:]:
          if num > max:
              max = num
      return max