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.
23 changes: 22 additions & 1 deletion q01_longest_even_word/build.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
# %load q01_longest_even_word/build.py
# Default imports

import re


# Write your solution here :
def q01_longest_even_word(sentence):
#splitting string at space and create new list of splitted element
elment_list = sentence.split()

# list of element whose length is even
even_list = list(filter(lambda x: len(x)%2 == 0, elment_list))

if even_list == []: # checking list is empty or not
return 0

length = 0 # for storing max value
name = '' # storing element which length is greatest in even_list
for el in even_list:
if length < len(el):
length = len(el)
name = el

return name # returning name whose ha
sentence = 'One great way to make predictions about an unfamiliar nonfiction text is to take a walk through the book before reading.'
q01_longest_even_word(sentence)




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.