input: Write a function to find and return the longest string in a given list of strings.
  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(['short', 'this_is_longer', 'medium'])=='this_is_longer'
  assert longest_string(['a', 'b', 'c'])=='a'
  assert longest_string(['python', 'java', 'javascript'])=='javascript'
  assert longest_string([])==''
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