input: Write a function to find the longest string in a list of strings. The function should take the list as input and return the longest string in the list. Return an empty string if the input list is empty.
  def longest_string(str_list):
      if len(str_list) == 0:
          return ''
      longest_str = str_list[0]
      for string in str_list:
          if len(string) > len(longest_str):
              longest_str = string
      return longest_str
  assert longest_string(['foo', 'test', 'longstring', 'bar']) == 'longstring'
  assert longest_string(['a', 'bc', 'def', 'ghij']) == 'ghij'
  assert longest_string(['short', 'mid', 'verylong', 'middle']) == 'verylong'
  assert longest_string([]) == ''
  assert longest_string(['same', 'same', 'same']) == 'same'
output: def longest_string(str_list):
      if len(str_list) == 0:
          return ''
      longest_str = str_list[0]
      for string in str_list:
          if len(string) > len(longest_str):
              longest_str = string
      return longest_str