Created
September 24, 2020 06:40
-
-
Save codetombomb/4cbf4b4449157d29d5b995998c3ca3f7 to your computer and use it in GitHub Desktop.
Conditionals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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