def longest(words): if not isinstance(words, (tuple,list)): raise TypeError('words must be sequence of strings') for w in words: if not isinstance(w, str): raise TypeError('elements must be strings') if len(words) = 0: raise ValueError('sequence must be nonempty') # ...now the real work can begin...