so here is my code
from typing import Iterable
def remove_all_before(items: list, border: int) -> Iterable:
it = []
if items == []:
return items
for i in items:
if border not in items :
return items
if items.index(border)<=items.index(i):
it.append(i)
return it
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!")
and when i press check solution it says that the result should be [5, 6, 7, 10] and my result is [5, 6, 7}
help
Created at: 2021/12/18 09:17; Updated at: 2021/12/18 15:54