input: Write a function to find the longest string in a given list of strings and return it.
  def longest_string(str_list):
      longest_str = ''
      for str in str_list:
          if len(str) > len(longest_str):
              longest_str = str
      return longest_str
  
  assert longest_string(['foo', 'test', 'longstring', 'bar'])=='longstring'
  assert longest_string(['a', 'bb', 'ccc', 'dddd'])=='dddd'
  assert longest_string(['hello', 'world', 'python'])=='python'
  assert longest_string([])==''
  assert longest_string(['single'])=='single'
output: def longest_string(str_list):
      longest_str = ''
      for str in str_list:
          if len(str) > len(longest_str):
              longest_str = str
      return longest_str