TypeError: неподдерживаемые типы операндов для +: «NoneType» и «NoneType».Python

Программы на Python
Ответить
Anonymous
 TypeError: неподдерживаемые типы операндов для +: «NoneType» и «NoneType».

Сообщение Anonymous »

Я сделал это в качестве небольшой забавной практики, используя свои новички в программировании на Python 3.5.

Код: Выделить всё

def potato_quant(number):
if number >= 5 and number < 100:
print("You've got more than 5 potatoes. Making a big meal eh?")
elif number >= 100 and number < 10000:
print("You've got more than 100 potatoes! What do you need all those potatoes for?")
elif number >= 10000 and number < 40000:
print("You've got more than 10000! Nobody needs that many potatoes!")
elif number >= 40000:
print("You've got more than 40000 potatoes. wut.")
elif number == 0:
print("No potatoes eh?")
elif number < 5:
print("You've got less than five potatoes. A few potatoes go a long way.")
else:
return 0
def potato_type(variety):
if variety == "Red":
print("You have chosen Red potatoes.")
elif variety == "Sweet":
print("You have chosen the tasty sweet potato.")
elif variety == "Russet":
print("You've got the tasty average joe potatoe!")
else:
print("Nice potato!")

print(potato_quant(15000) + potato_type("Sweet"))
Целью кода было ввести два значения и получить две строки по моему выбору. Однако когда я запускаю код, я получаю сообщение об ошибке:

Код: Выделить всё

TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'
Я новичок, поэтому сколько бы я ни просматривал это, я не могу понять, в чем дело. Любая помощь будет очень признательна, в основном для будущего использования.

Подробнее здесь: https://stackoverflow.com/questions/341 ... d-nonetype
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»