input: Write a function to calculate the sum of the series 1 + ½ + ⅓ + ... + 1/n. If the given n is less than 1, return 0. Use regular for loop, and initialize the total sum to 0, add 1/i in each iteration.. Give the assert test cases and the intention result.
  
  def seriesSum(n):
      if n < 1:
          return 0
      total = 0
      for i in range(1, n+1):
          total += 1 / i
      return total
  
  assert seriesSum(5) == 2.283333333333333
  assert seriesSum(1) == 1
  assert seriesSum(0) == 0
  assert seriesSum(10) == 2.9289682539682538
output: def seriesSum(n):
      if n < 1:
          return 0
      total = 0
      for i in range(1, n+1):
          total += 1 / i
      return total