0
def insert(lst, v):
""" (list of int, int) -> NoneType
Insert v into lst just before the rightmost item greater than v, or at
index 0 if no items are greater than v.
>>> my_list = [3, 10, 4, 2]
>>> insert(my_list, 5)
>>> my_list
[3, 5, 10, 4, 2]
>>> my_list = [5, 4, 2, 10]
>>> insert(my_list, 20)
>>> my_list
[20, 5, 4, 2, 10]
"""
for idx, val in enumerate(lst):
if val > v:
lst.insert(idx, v)
break
else:
lst.insert(0, v)
当我尝试测试函数时,它不通过其中一个隐藏的测试用例,它在列表中有两个项大于该值。示例中的所有其他内容都会通过。我应该如何更改退货声明以解决此问题?在最右边的项大于值之前将值插入到int列表中?