Skip to content
Permalink
196c1205be
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
20 lines (19 sloc) 846 Bytes
# Made by Andris Jansons
from WeatherFinder import weatherFinder
def weatherInit(text):
"""Find location in sentence or assume it's Coventry and ask for weather details"""
try:
if 'in' in text: #Next word after "in" or "for" should be location
i = text.index('in')
location = text[i+1]
elif 'for' in text:
i = text.index('for')
location = text[i+1]
else:
location = 'Coventry, UK'
status, temperature, wind, humidity = weatherFinder(location)
except:
location = 'Coventry, UK'
status, temperature, wind, humidity = weatherFinder(location)
finally:
return "Status: "+status+"\nTemperature in "+location+" is "+temperature+"°C, wind speed is "+wind+" m/s and the air humidity is "+humidity+"%"