input: Write a function to find the smallest number in a given list. If the list is empty, return None.
  def find_smallest_number(nums):
      if not nums:
          return None
      smallest = nums[0]
      for num in nums:
          if num < smallest:
              smallest = num
      return smallest
  
  assert find_smallest_number([4, 5, 6, 7, 8])==4
  assert find_smallest_number([10, 20, 3, 40])==3
  assert find_smallest_number([-1, -2, -3, -4])==-4
  assert find_smallest_number([])==None
output: def find_smallest_number(nums):
      if not nums:
          return None
      smallest = nums[0]
      for num in nums:
          if num < smallest:
              smallest = num
      return smallest