In jede Temperaturklassifizierung habe ich eine weitere if-Anweisung eingefügt, um zu überprüfen, ob es regnet.
Ich habe außerdem eine weitere Eingabefunktion eingefügt, die den Benutzer auffordert, die Windgeschwindigkeit einzugeben. Allerdings fällt es mir schwer, eine weitere Ebene verschachtelter if-Anweisungen einzufügen, um den Wind als „Ruhig“, „Briseig“ oder „Windig“ zu klassifizieren.
Hier ist mein bisheriger Code:
Code: Select all
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
Mobile version