Created
July 17, 2017 22:16
-
-
Save saevarb/8e1292b19a6dd7b5739770cb24c722aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def longest(input_string): | |
# no need for the type check. | |
# str is built-in. use another name(and use the right variable) | |
longest_len = 0 | |
words = input_string.split() | |
longest = '' | |
for word in words: | |
if len(word) > len(longest): | |
longest = word | |
return longest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment