Найти - Пользователи
Полная версия: Ошибка argument of type 'NoneType' is not iterable
Начало » Центр помощи » Ошибка argument of type 'NoneType' is not iterable
1
dmitry_sulin
Программа должна выводить список из повторяющихся элементов введенного списка
a =
b =
for i in a:
a_removed = a.remove(i)
if i in a_removed:
b.append(i)
print(b)

а выдает ошибку в 5-й строке: TypeError: argument of type ‘NoneType’ is not iterable

В чем, вообще смысл этой ошибки?
giveback
функция remove() не возвращает ничего, поэтому в переменной a_removed будет пусто (NoneType) , и над ней нельзя выполнить операцию in (пятая строка кода)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB