diff --git a/__pycache__/__init__.cpython-36.pyc b/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..1222f76 Binary files /dev/null and b/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_longest_even_word/__pycache__/__init__.cpython-36.pyc b/q01_longest_even_word/__pycache__/__init__.cpython-36.pyc index 8ad4b68..67377b7 100644 Binary files a/q01_longest_even_word/__pycache__/__init__.cpython-36.pyc and b/q01_longest_even_word/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_longest_even_word/__pycache__/build.cpython-36.pyc b/q01_longest_even_word/__pycache__/build.cpython-36.pyc index 7926364..d973e8b 100644 Binary files a/q01_longest_even_word/__pycache__/build.cpython-36.pyc and b/q01_longest_even_word/__pycache__/build.cpython-36.pyc differ diff --git a/q01_longest_even_word/build.py b/q01_longest_even_word/build.py index 0685739..2cfb52a 100644 --- a/q01_longest_even_word/build.py +++ b/q01_longest_even_word/build.py @@ -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) + + + + diff --git a/q01_longest_even_word/tests/__pycache__/__init__.cpython-36.pyc b/q01_longest_even_word/tests/__pycache__/__init__.cpython-36.pyc index 7782007..b34309e 100644 Binary files a/q01_longest_even_word/tests/__pycache__/__init__.cpython-36.pyc and b/q01_longest_even_word/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_longest_even_word/tests/__pycache__/test.cpython-36.pyc b/q01_longest_even_word/tests/__pycache__/test.cpython-36.pyc index a62a5d8..859b779 100644 Binary files a/q01_longest_even_word/tests/__pycache__/test.cpython-36.pyc and b/q01_longest_even_word/tests/__pycache__/test.cpython-36.pyc differ