id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

david.white@denison.edu cs111fall2019 > longest
prev  |  next  |  chance

Write a function longest(data) that returns the longest string in the list of strings named data. For example, longest([’Tris’, ’Tobias’, ’Caleb’]) should return ’Tobias’. If there is a tie it should return the first word of that length.


longest(['some', 'lengthy', 'words', 'and', 'some', 'short']) → 'lengthy'
longest(['a', 'b', 'c', '', 'd', 'e']) → 'a'
longest(['ab', 'abb', 'a', 'babbbbb', 'abab', 'a']) → 'babbbbb'

...Save, Compile, Run (ctrl-enter)

def longest(data):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Copyright Nick Parlante 2017 - privacy