Python2017/labs03/task04.py
2017-12-16 00:02:00 +01:00

30 lines
662 B
Python

from weather import Weather
import datetime as d
weather = Weather()
weatherWro = weather.lookup_by_location("Wroclaw")
print(weatherWro.condition().text())
def fc_conv (f):
res = round((float(f) - 32) / 1.8, 2)
return res
print(fc_conv(1))
fcst = weatherWro.forecast()
temp=[]
day=[]
for i in fcst:
day.append(i.date())
temp.append(i.low())
dayMin = day[temp.index(min(temp))]
dayMin2 = d.datetime.strptime(dayMin, '%d %b %Y')
dayTxt = (dayMin2.weekday())
daysPl = ["Poniedzialek", "Wtorek", "Sroda", "Czwartek", "Piatek", "Sobota", "Niedziela"]
#print(dayMin)
print(daysPl[dayTxt])
print(fc_conv(min(temp)))