|
|
Регистрация Восстановить пароль |
Регистрация | Задать вопрос |
Заплачу за решение |
Новые сообщения |
Сообщения за день |
Расширенный поиск |
Правила |
Всё прочитано |
|
Опции темы | Поиск в этой теме |
07.07.2016, 20:58 | #1 |
Новичок
Джуниор
Регистрация: 07.07.2016
Сообщений: 1
|
Ошибка: TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType' Как исправить?
Я изучаю Python месяц и ещё новичок.
Решил создать простую игру. Название: Охотник за пузырями. Но при запуске выдаёт ошибку: Traceback (most recent call last): File "C:\Python33\Охотник за пузырями. py", line 97, in score += collision() TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType' Что не так? Вот код: Код:
Последний раз редактировалось Alex11223; 07.07.2016 в 21:10. |
07.07.2016, 21:13 | #2 |
Старожил
Регистрация: 12.01.2011
Сообщений: 19,500
|
Код collision странный, может быть return points должно было быть после цикла? (1 отступ вместо 2).
Ушел с форума, https://www.programmersforum.rocks, alex.pantec@gmail.com, https://github.com/AlexP11223
ЛС отключены Аларом. |
07.07.2016, 21:25 | #3 |
юзер как все
Участник клуба
Регистрация: 10.01.2012
Сообщений: 1,586
|
Alex11223 правильно подметил.
return должен быть по любому. даже если небыло нужных совпадений А у вас получается перебор, и если нет совпадений то ничего (None) "возвращается" А None + Integer неможет быть, вот они говорит что for +=: 'int' and 'NoneType' Вот так попробуйте PHP код:
<Дзен - Вся вселенная в тебе > | Резюме: https://ch3ll0v3k.github.io/CV/
Последний раз редактировалось pompiduskus; 07.07.2016 в 21:28. |
Похожие темы | ||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
Operator not applicable to this operand type | NewLamer&Programer | Общие вопросы Delphi | 5 | 11.05.2013 13:27 |
С++ not implemented in type 'istream' for arguments of type 'float *'из-за чего эта ошибка и как исправить? | Mitax-47 | Помощь студентам | 1 | 10.05.2013 15:48 |
Operator not applicable to this operand type | Makaralex | Помощь студентам | 2 | 07.09.2012 11:52 |
Operator not applicable to this operand type | welcomeTo | Помощь студентам | 9 | 06.06.2011 21:01 |
ошибка - [Error] Unit1.pas(325): Operator not applicable to this operand type | blackstersl | Общие вопросы Delphi | 6 | 27.08.2008 13:17 |