After the function declaration, read (using the input function) a list of city names written on a single line separated by a space. Then, using the list generator and the generated function, generate a list of city names at least six characters long from the input list.
This is my code:
def is_large(lst):
for i in lst:
if len(i) < 6:
print(lst)
return False
else:
return True
print(is_large(str(input())))
input: London Paris Nant Munich Krakow
Output: London Munich Krakow
So according to your post title, I believe this is what you're asking for:
def isWordAllowed(word, allowedLength):
if (len(word) >= allowedLength):
return True
return False
Then call the function on your list of words:
list = input().split()
for word in list:
if (isWordAllowed(word, 6)):
print(word)