Question: PYTHON RECURSIVE METHOD: Write a function called in_order, which returns True if a # list of words is in lexicographical order (i.e., they # appear
PYTHON RECURSIVE METHOD:
Write a function called in_order, which returns True if a # list of words is in lexicographical order (i.e., they # appear in the same order in which they would appear in # the dictionary). Do not use the sort function. Assume the # words are all lower case. For example: # # >>> in_order(['apple', 'grape', 'grapefruit', 'orange', 'pear']) # True # >>> in_order(['apple', 'grape', 'pear', 'banana']) # False # def in_order(words): if len(words) <= 1: # base case 1 pass elif False: # base case 2 pass else: # recursive case pass
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
