Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added __pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q01_longest_even_word/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q01_longest_even_word/__pycache__/build.cpython-36.pyc
Binary file not shown.
19 changes: 18 additions & 1 deletion q01_longest_even_word/build.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
# %load q01_longest_even_word/build.py
# Default imports

import re
from nltk.tokenize import word_tokenize

sentence = 'photographs or other images, readers can start to get a sense about the topic. This scanning and skimming helps set the expectation for the reading.'
data1 = 'One great way to make predictions about an unfamiliar nonfiction text is to take a walk through the book before reading.'

# Write your solution here :
def q01_longest_even_word(sentence):
new = sentence.split(' ')
for x in new:
if x == '':
new.pop(0)
even = [x for x in new if len(x)%2 == 0]
if len(even) != 0:
return max(even,key = len)
if len(even) == 0:
return 0
q01_longest_even_word(data1)






Binary file modified q01_longest_even_word/tests/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q01_longest_even_word/tests/__pycache__/test.cpython-36.pyc
Binary file not shown.