input: Write a function to find the maximum number in a list. The function should iterate through the list and keep track of the largest number found. If the list is empty, the function should return None.
  def max_num(list):
    if not list:
      return None
    max_num = list[0]
  
    for num in list:
      if num > max_num:
        max_num = num
    
    return max_num
  
  assert max_num([9, 2, 5, 6, 4, 1])==9
  assert max_num([3, 7, 2, 10, 1, 5])==10
  assert max_num([1, 1, 1, 1])==1
  assert max_num([])==None
output: def max_num(list):
    if not list:
      return None
    max_num = list[0]
  
    for num in list:
      if num > max_num:
        max_num = num
    
    return max_num