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