почему код выдает ошибку list.remove(x): x not in list
def rand_b():
col = randint(2,8)
while True:
for i in range(col):
p = randint(2, 2)
ptr.append(p)
m1 = ptr.count(1)
m2 = ptr.count(2)
shuffle(ptr)
print(ptr)
print(col)
if m2 == col or m1 == col:
ptr.remove(all)
else:
break
rand_b()
Ответы (1 шт):
Автор решения: Stanislav Volodarskiy
→ Ссылка
all - имя глобальной функции в Питоне:
$ python -c "help(all)" Help on built-in function all in module builtins: all(iterable, /) Return True if bool(x) is True for all values x in the iterable. If the iterable is empty, return True. (END)
Возможно вы хотели удалить все элементы из списка. Для этого есть ptr.clear().