Initial commit
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
def longest_word(filename):
|
||||
with open(filename, 'r') as infile:
|
||||
words = infile.read().split()
|
||||
max_len = len(max(words, key=len))
|
||||
return [word for word in words if len(word) == max_len]
|
||||
|
||||
print(longest_word('test.txt'))
|
||||
Reference in New Issue
Block a user