Skip to content

Instantly share code, notes, and snippets.

@codetombomb
Created September 24, 2020 06:40
Show Gist options
  • Save codetombomb/4cbf4b4449157d29d5b995998c3ca3f7 to your computer and use it in GitHub Desktop.
Save codetombomb/4cbf4b4449157d29d5b995998c3ca3f7 to your computer and use it in GitHub Desktop.
Conditionals
def forecast(rain_chance, temp):
if rain_chance >= 60 and temp > 70:
print(
f"With a {rain_chance}% chance of rain today, don't forget your umbrella!")
elif rain_chance <= 30 and temp < 80 and temp > 60:
print("Enjoy the beautiful weather today")
elif rain_chance >= 60 and temp < 40:
print("Its going to be a cold and wet day today. Dress appropriately and be safe out there.")
elif rain_chance == 0 and temp < 40:
print(
f"Wear a jacket today bacause the temps will be around {temp} degrees but we don't expect any rain")
elif rain_chance == 0 and temp > 85:
print(
f"Its going to be a dry and hot one today with temps around {temp}")
if __name__ == "__main__":
forecast(65, 71)
forecast(20, 75)
forecast(61, 36)
forecast(0, 33)
forecast(0, 90)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment