def smallest_score(lst: list[int]) -> int: ''' Valid sublists have at least 2 elements. Return the smallest score of any valid sublist of lst. lst is guaranteed to have at least 2 elements. '''...


def smallest_score(lst: list[int]) -> int:
     '''
     Valid sublists have at least 2 elements.
     Return the smallest score of any valid sublist of lst.
     lst is guaranteed to have at least 2 elements.
     '''
     in_order = lst[:]
     in_order.sort()
     res = in_order[1] - in_order[0]
     for i in range(len(in_order) - 1):
     res = min(res, in_order[i+1] - in_order[i])
     return res


"""
Unfortunately, your code is not correct.
Below, write a Pytest test case that fails,
but that should pass if your smallest_score function were correct.


Write ONLY the Pytest test case; don't try to fix the busted smallest_score code.
"""


# write pytest test function here



Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here