input: Write a function to find the maximum number from a given list. The function should iterate through the list and return the maximum value found. If the list is empty, the function should return None.
  assert max_num([5, 4, 2, 7, 12])==12
  assert max_num([1, 2, 3, 4, 5])==5
  assert max_num([-1, -2, -3, -4, -5])==-1
  assert max_num([])==None
output: def max_num(lst):
      if not lst:
          return None
      max_value = lst[0]
      for num in lst:
          if num > max_value:
              max_value = num
      return max_value