forked from tdwojak/Python2017
labs04 z1
This commit is contained in:
parent
d267afe390
commit
03bcc26529
0
labs03/task0.py
Normal file
0
labs03/task0.py
Normal file
6
labs03/task01.py
Normal file
6
labs03/task01.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
a =[1,2,3,4,5]
|
||||||
|
b='asdf'
|
||||||
|
c=0.5
|
||||||
|
print(id(a))
|
||||||
|
print(id(b))
|
||||||
|
print(id(c))
|
10
labs03/task02.py
Normal file
10
labs03/task02.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
def fib(n):
|
||||||
|
l = [0, 1,]
|
||||||
|
for i in range(2, n):
|
||||||
|
l.append(l[i-1] + l[i-2])
|
||||||
|
yield l
|
||||||
|
|
||||||
|
|
||||||
|
x = fib(7)
|
||||||
|
for i in x:
|
||||||
|
print(i)
|
4
labs03/task03.py
Normal file
4
labs03/task03.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import requests
|
||||||
|
r = requests.get('https://api.fixer.io/latest')
|
||||||
|
j=r.json()
|
||||||
|
print(j['rates']['PLN'])
|
29
labs03/task04.py
Normal file
29
labs03/task04.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
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)))
|
||||||
|
|
20
labs03/task05.py
Normal file
20
labs03/task05.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
from glob import glob as g
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
|
||||||
|
for file in g('scores/model.iter*.npz.bleu'):
|
||||||
|
with open(file, 'r') as of:
|
||||||
|
fl = of.readline()
|
||||||
|
cB = float(fl[fl.find("=") + 1:fl.find(",")])
|
||||||
|
|
||||||
|
if i == 0:
|
||||||
|
maxB = cB
|
||||||
|
maxBF =file
|
||||||
|
else:
|
||||||
|
if cB > maxB:
|
||||||
|
maxB = cB
|
||||||
|
maxBF = file
|
||||||
|
i += 1
|
||||||
|
of.close()
|
||||||
|
|
||||||
|
print(maxBF)
|
Loading…
Reference in New Issue
Block a user