Внутри каждой температурной классификации я добавил еще один оператор if, чтобы проверить, идет ли дождь.
Я также включил еще одну функцию ввода, которая просит пользователя ввести скорость ветра. Хотя я изо всех сил пытаюсь включить еще один уровень вложенных операторов if, чтобы классифицировать ветер как «Спокойный», «Ветреный» или «Ветреный».
Вот мой код:
Код: Выделить всё
temperature = float(input("Please enter the temperature in Celsius: "))
raining = input("Is it raining? Yes/No".lower())
wind_speed = input("Please enter the wind speed in km/h: ")
# Calm = 0-5 Breezy = 6-49 Windy = 50-61
if temperature >= 25:
condition = "Hot"
if raining == "yes":
condition += " and raining"
else:
condition += " and dry"
if wind_speed >= 0 and wind_speed = 6 and wind_speed = 15:
condition = "Warm"
if raining == "yes":
condition += " and raining"
else:
condition += " and dry"
if wind_speed >= 0 and wind_speed = 6 and wind_speed = 0 and wind_speed = 6 and wind_speed
Подробнее здесь: [url]https://stackoverflow.com/questions/79864654/how-do-i-include-another-level-of-python-nested-if-statements-to-classify-the-wi[/url]
Мобильная версия