Muna_Frank

Untitled

Feb 22nd, 2020
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. #Function that checks for the existence of a word with more that 4 chracters in a list
  2. def long_word_in_collection(word_list, word):
  3.     if word in word_list and len(word) > 4:
  4.         return True
  5.     else:
  6.         return False
  7.  
  8. #Testing the function
  9. word_collection = ["open", "source", "festival", "Africa"]
  10. print(long_word_in_collection(word_collection, "open"))
  11. print(long_word_in_collection(word_collection, "Festival"))
Add Comment
Please, Sign In to add comment