In: Computer Science
Design a function in python that takes a list of strings as an argument and determines whether the strings in the list are getting decreasingly shorter from the front to the back of the list
Thanks for the question. Below is the code you will be needing. Let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please leave a +ve feedback : ) Let me know for any help with any other questions. Thank You! =========================================================================== # Design a function in python that takes a list of strings as an # argument and determines whether the strings in the list are # getting decreasingly shorter from the front to the back of the list def is_decreasing(words): for i in range(0, len(words) - 1): if len(words[i]) < len(words[i + 1]): return False return True print(is_decreasing(['aaa', 'aa', 'a', ''])) print(is_decreasing(['', 'a', 'aa', 'aaa']))
================================================================