input: Write a python function to calculate the standard deviation of a list.
  assert std_dev([2, 4, 4, 4, 5, 5, 7, 9]) == 2.0
  assert std_dev([1, 2, 3, 4, 5]) == 1.4142135623730951
  assert std_dev([10, 12, 23, 23, 16, 23, 21, 16]) == 4.898979485566356
output: def std_dev(nums):
      if len(nums) == 0:
          return 0.0
      mean = sum(nums) / len(nums)
      variance = sum((x - mean) ** 2 for x in nums) / len(nums)
      return variance ** 0.5