input: Write a function to find the smallest number in a given list by iterating through the list and keeping track of the smallest value encountered. The function should return the smallest number. If the list is empty, the function should return None.
  assert smallestNumber([4, 5, 6, 7, 8])==4
  assert smallestNumber([9, 2, 3, 1, 7])==1
  assert smallestNumber([5])==5
  assert smallestNumber([])==None
output: def smallestNumber(lst):
      if not lst:
          return None
      smallest = lst[0]
      for num in lst:
          if num < smallest:
              smallest = num
      return smallest