Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """ The function to test if a word exists in a list
- and it has more than 4 characters"""
- #The function is named long_word_in_collection and it has accepts two arguments
- def long_word_in_collection(list_of_words, word):
- if word in list_of_words and len(word) > 4: # Word Existence and Length
- return True
- else:
- return False
- print(long_word_in_collection(["cat", "dog", "rhino"], "rhino")) # True
- print(long_word_in_collection(["cat", "dog", "rhino"], "cat")) # False
- print(long_word_in_collection(["cat", "dog", "rhino"], "monkey")) # False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement