input: Write a function to optimize the provided Python program that finds the maximum number in a given list. If the list is empty, return None.
  assert max_num([9, 2, 5, 6, 4, 1])==9
  assert max_num([-1, -3, -5, -2, -4, -6])==-1
  assert max_num([10])==10
  assert max_num([4, 8, 2, 8, 4, 5, 6, 3])==8
  assert max_num([])==None
output: def max_num(lst):
      if not lst:
          return None
      return max(lst)