How can I create a Python custom function to get list of strings having length more than a number n
when we pass number n
and list of strings?
I tried using this function but it returns None
:
lst=['shiva', 'patel', 'ram','krishna', 'bran']
filtered_list=[]
def word_remove(n, lst):
for i in lst:
if len(i)>n:
return filtered_list.append(i)
print(word_remove(4,lst))
The output is :
None