Not sure where some of the "correct answers" came from on this exercise
def remove_all_before(items: list, border: int) -> Iterable:
new_list = []
for x in items:
if border not in items:
new_list = items
elif not items:
return items
elif items.index(x) >= items.index(border):
new_list.append(x)
return new_list
if __name__ == '__main__':
# print("Example:")
# print(list(remove_all_before([1, 2, 3, 4, 5], 3)))
# These "asserts" are used for self-checking and not for an auto-testing
assert list(remove_all_before([1, 2, 3, 4, 5], 3)) == [3, 4, 5]
assert list(remove_all_before([1, 1, 2, 2, 3, 3], 2)) == [2, 2, 3, 3]
assert list(remove_all_before([1, 1, 2, 4, 2, 3, 4], 2)) == [2, 4, 2, 3, 4]
assert list(remove_all_before([1, 1, 5, 6, 7], 2)) == [1, 1, 5, 6, 7]
assert list(remove_all_before([], 0)) == []
assert list(remove_all_before([7, 7, 7, 7, 7, 7, 7, 7, 7], 7)) == [7, 7, 7, 7, 7, 7, 7, 7, 7]
print("Coding complete? Click 'Check' to earn cool rewards!")
the messages I get when checking are
Your result:[5,6,7]
Right result:[5,6,7,10]
Fail:removeallbefore([10,1,5,6,7,10],5)
Created at: 2021/07/14 02:30; Updated at: 2021/07/14 03:10