Advertisement
OsahonE

Wk4_4

Mar 31st, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. '''A program that returns True if second
  2. argument passed is in the first argument -
  3. a list and second argument has a length
  4. of more than 4 characters, otherwise
  5. returns False'''
  6.  
  7. def long_word_in_collection(list, arg: str):
  8.     if arg in list and len(arg) > 4:
  9.         return True
  10.     else:
  11.         return False
  12.  
  13. animals = ["dog", "cat", "rhino", "bat", "antelope"]
  14.  
  15. print(long_word_in_collection(animals, "antelope"))
  16.  
  17. print(long_word_in_collection(animals, "dog"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement