input: Write a function to find and return the maximum number from a given list of integers. If the list is empty then return None.
  assert max_num([5, 4, 2, 7, 12])==12
  assert max_num([-1, -5, -2, -7, -3])==-1
  assert max_num([1])==1
  assert max_num([])==None
output: def max_num(nums):
      if not nums:
          return None
      return max(nums)