I wrote this program that would get the current days forecast and then tell you if you should pack an umbrella or not. The problem is:
forecast = Mostly sunny, with a high near 46. Breezy, with a west wind 16 to 22 mph, with gusts as high as 44 mph.
so it is my understanding that the if statement should not execute and go straight to the else statement. But that is not happening. Any help would be appreciated.
The output is:
Mostly sunny, with a high near 46. Breezy, with a west wind 16 to 22 mph, with gusts as high as 44 mph.
Forecast calls for rain. Will send an email to remind for an umbrella.
Process finished with exit code 0
#Get weather from webpage
weatherToday = weather.find('div', class_='row row-odd row-forecast')
forecast = weatherToday.find('div',class_='col-sm-10 forecast-text').text
#print (weatherToday.prettify())
print(forecast)
print()
#Search through forecast to check for rain
#words = ['rain', 'showers']
#rain = forecast.find('rain')
#showers = forecast.find('showers')
if 'rain' or 'showers' in forecast:
print('Forecast calls for rain. Will send an email to remind for an umbrella.\n')
ezgmail.send('XXXXXX@gmail.com', 'Rain Forecast', 'Expected to rain. Pack an umbrella.')
#percipitaion = True
else:
print('Forecase does not call for rain. No reminder needed.\n ')
ezgmail.send('XXXXXX@gmail.com', 'Rain Forecast', 'Not Expected to rain. No umbrella needed.')
#percipitaion = False