Skip to content

Instantly share code, notes, and snippets.

@sunnya97
Created August 6, 2019 19:57
Show Gist options
  • Save sunnya97/3ec14ce1ba175040e706c2ab450ab936 to your computer and use it in GitHub Desktop.
Save sunnya97/3ec14ce1ba175040e706c2ab450ab936 to your computer and use it in GitHub Desktop.
import pywapi
import string
import random
weather_com_result = pywapi.get_weather_from_weather_com('20740', 'imperial')
text = weather_com_result['current_conditions']['text']
temp = weather_com_result['current_conditions']['temperature']
temp = int(temp)
if("Sunny" not in text):
print("No videochat will occur today because the weather is " + text + ", not Sunny.")
else:
print("There was a " + str(temp) + " percent change of videochatting today")
random_int = random.randrange(1, 101)
if(random_int <= temp):
print("And you will videochat today!")
else:
print("However fate has determined that you shall not.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment