Need Help Python Function Got Stuck Write Function Accepts Two Arguments 1 Integer 2 List Q37059795

Need help in python function. I got stuck.

Write a function that accepts two arguments: 1-an integer and2-a list of strings. The function should return True if ALL of thestrings are longer than the first argument. Otherwise, the functionshould return False.

use this list to test:

lstStrings = [‘hello’,’goodbye’,’Tom Cruise isweird.’,’Gryffindor rules’,’hmm’]

caller:

print( checkStringLength(3,lstStrings) )

  print( checkStringLength(4,lstStrings) )


Solution


def checkStringLength(n, lst): for x in lst: if(len(x)<=n): return False return True

==================================

Please comment below if you have any doubts. I willupdate my

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.