input: 写一个函数来优化查找列表中最大元素的过程,使用标准格式,有清晰的函数名和详细的函数定义,明确的示例和预期结果。
  期待的输出示例:
  
  Write a function to optimize finding the maximum number in a list.
  def max_num(list):
    return max(list)
  
  assert max_num([9, 2, 5, 6, 4, 1])==9 
  assert max_num([1, 3, 5, 7])==7
  assert max_num([3, 1])==3
  assert max_num([9])==9
  assert max_num([])==None
  If the list is empty return None.
output:     
  def max_num(lst):
      if not lst:
          return None
      return max(lst)
  
  assert max_num([9, 2, 5, 6, 4, 1]) == 9
  assert max_num([1, 3, 5, 7]) == 7
  assert max_num([3, 1]) == 3
  assert max_num([9]) == 9
  assert max_num([]) == None
  