1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
def pleasantries():
x=input('what is your name? ')
print('Welcome',x,'\n will it snow you dont know so enter your location. ')
pleasantries()
def obtain_from_server_weather():
import requests
api_adress= 'http://api.openweathermap.org/data/2.5/weather?appid=3c0ba2480210acb47208b3f0fd4ee04a&q='
city=(input('Please input city name: '))
print('contacting server...')
url= api_adress+city
data=requests.get(url).json()
weather_list= data['weather']
weather_main=weather_list[0]
description=weather_main['description']
print('----------------------------------------------')
print(' will it snow')
print('----------------------------------------------')
print('Weather:',description)
weather_main=data['main']
temp_1=weather_main['temp']
temp_farenheit=(1.8*(temp_1-273)+32)
print('Temperature (F)',temp_farenheit)
min_temp=weather_main['temp_min']
max_temp=weather_main['temp_max']
min_temp_farenheit=(1.8*(min_temp-273)+32)
max_temp_farenheit=(1.8*(max_temp-273)+32)
obtain_from_server_weather()