Как изменить переменную footprint? [закрыто]Python

Программы на Python
Anonymous
Как изменить переменную footprint? [закрыто]

Сообщение Anonymous »

Я пытаюсь изучить основы программирования в Академии Хана. Но при запуске программы я получаю неожиданный результат:

Есть ли у вас домашнее животное (да/нет)? да

Содержит ли корм вашего питомца мясо (да/нет)?да

Сколько дней в неделю вы ездите в школу или на работу? 0

Ваша оценка воздействия на окружающую среду равна 0.

Это мой код:

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

footprint = 0

has_pet = input("Do you have a pet (yes/no)? ")
pet_food_meat = None

if has_pet == "yes":
pet_food_meat = input("Does your pet food contain meat (yes/no)?")
# Pets consume resources like water, litter, and toys.
footprint += 5
if pet_food_meat == "yes":
footprint += 10

if has_pet == "no":
pet_food_meat == "no"

days = int(input("How many days a week do you commute to school or work? "))
transport = None

if days > 0:
transport = input("Do you commute by foot, bike, bus, train, or car? ")

# Different methods of transportation have different environmental impacts.
if transport == "car":
footprint += (8 * days)
elif transport == "bus" or transport == "train":
footprint = 4 * days
else:
footprint = days

print("Your environmental footprint score is " + str(footprint) + ".")
В строках 9 и 11 я добавляю 5 и 10 соответственно к значению посадочного места, но всякий раз, когда я тестирую код, значение посадочного места по-прежнему равно 0. Что я сделал не так?

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