1
0
forked from tdwojak/Python2017

Compare commits

..

11 Commits

Author SHA1 Message Date
a0fecba5c4 Final updates 2018-01-29 12:22:18 +01:00
26afa652a5 update 2018-01-24 10:26:29 +01:00
f61d161938 update results 2018-01-23 22:34:37 +01:00
5d25e165c4 Update 45163 2018-01-23 22:05:16 +01:00
dc5fb3f34b Add marks 2018-01-23 17:19:50 +01:00
fd67d4b96f Add task06 2018-01-23 16:54:47 +01:00
1599eb71ba update szwedek 2018-01-22 15:42:47 +01:00
524eefe436 Update scores for 45161 2018-01-19 08:50:18 +01:00
7ef244fb88 Fix socres for 147 2018-01-18 17:41:40 +01:00
d8025c91ff Add missed results 2018-01-15 11:11:11 +01:00
378fee7582 Update results 2018-01-11 13:41:08 +01:00
26 changed files with 71 additions and 277 deletions

View File

@ -1,24 +1,38 @@
ID | labs02:task07 | labs02:task08 | labs02:task09 | labs02:task10 | labs02:task11 ID | labs02:task07 | labs02:task08 | labs02:task09 | labs02:task10 | labs02:task11 | labs03 | labs04 | labs06 | Punkty | Ocena |
---------|-----------------|-----------------|-----------------|-----------------|--------------- ---------|-----------------|-----------------|-----------------|-----------------|-----------------|----------|----------|----------|--------|-------|
s45168 | 0 | 0 | 0 | 0 | 0 s45146 | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 8 | 22 | 5 |
s45162 | 1 | 1 | 1 | 1 | 1 s45147 | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 8 | 22 | 5 |
s45158 | 1 | 1 | 0 | 0 | 1 s45148 | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 8 | 22 | 5 |
szwedek | 1 | 1 | 1 | 1 | 1 s45150 | 1 | 1 | 1 | 1 | 1 | 2 | 1 | 8 | 16 | 4 |
s45155 | 1 | 1 | 1 | 1 | 1 s45151 | 1 | 1 | 1 | 1 | 1 | 0 | 5 | 8 | 18 | 4.5 |
s45152 | 1 | 1 | 1 | 0 | 1 s45152 | 1 | 1 | 1 | 0 | 1 | 0 | 5 | 8 | 17 | 4 |
s45148 | 1 | 1 | 1 | 1 | 1 s45153 | 0 | 1 | 1 | 1 | 1 | 4 | 0 | 8 | 16 | 4 |
s45166 | 1 | 1 | 1 | 1 | 1 s45155 | 1 | 1 | 1 | 1 | 1 | 1 | 5 | 8 | 19 | 4.5 |
s45151 | 1 | 1 | 1 | 1 | 1 s45156 | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 8 | 22 | 5 |
s45146 | 1 | 1 | 1 | 1 | 1 s45157 | 1 | 1 | 1 | 1 | 1 | 4 | 4 | 8 | 21 | 5 |
s45150 | 1 | 1 | 1 | 1 | 1 s45158 | 1 | 1 | 0 | 0 | 1 | 4 | 5 | 8 | 19 | 4.5 |
s45452 | 1 | 1 | 1 | 1 | 1 s45159 | 1 | 1 | 1 | 1 | 1 | 2 | 3 | 8 | 18 | 4.5 |
s45165 | 1 | 1 | 1 | 1 | 1 s45160 | 1 | 1 | 1 | 1 | 1 | 4 | 4 | 8 | 21 | 5 |
s45160 | 1 | 1 | 1 | 1 | 1 s45161 | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 8 | 22 | 5 |
s45153 | 0 | 0 | 0 | 0 | 0 s45162 | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 8 | 22 | 5 |
s45156 | 1 | 1 | 1 | 1 | 1 s45163 | 1 | 1 | 1 | 1 | 1 | 4 | 4 | 8 | 21 | 5 |
s45157 | 0 | 0 | 1 | 1 | 1 s45164 | 1 | 1 | 0 | 1 | 0 | 0 | 5 | 8 | 16 | 4 |
s45167 | 1 | 1 | 1 | 1 | 1 s45165 | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 8 | 22 | 5 |
s45147 | 1 | 0 | 0 | 1 | 0 s45166 | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 8 | 22 | 5 |
s45159 | 0 | 0 | 0 | 0 | 0 s45167 | 1 | 1 | 1 | 1 | 1 | 0 | 5 | 8 | 17 | 4 |
s45161 | 1 | 1 | 1 | 1 | 1 s45168 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
s45164 | 1 | 1 | 0 | 1 | 0 s45452 | 1 | 1 | 1 | 1 | 1 | 4 | 4 | 8 | 21 | 5 |
szwedek | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 10 | 24 | 5 |
Skala:
Punkty | Ocena |
-------|-------|
24-20 | 5 |
19-18 | 4.5 |
17-16 | 4 |
15-13 | 3 |
12-0 | 2 |
Max: 22

View File

@ -7,7 +7,7 @@ która zawiera tylko elementy z list o parzystych indeksach.
""" """
def even_elements(lista): def even_elements(lista):
return lista[::2] pass
def tests(f): def tests(f):

View File

@ -5,14 +5,9 @@
Napisz funkcję days_in_year zwracającą liczbę dni w roku (365 albo 366). Napisz funkcję days_in_year zwracającą liczbę dni w roku (365 albo 366).
""" """
def days_in_year(year): def days_in_year(days):
if year % 4 == 0: pass
if year % 100 > 0 or year % 400 == 0:
return 366
else:
return 365
else:
return 365
def tests(f): def tests(f):
inputs = [[2015], [2012], [1900], [2400], [1977]] inputs = [[2015], [2012], [1900], [2400], [1977]]
outputs = [365, 366, 365, 366, 365] outputs = [365, 366, 365, 366, 365]

View File

@ -13,12 +13,8 @@ jak 'set', która przechowuje elementy bez powtórzeń.)
def oov(text, vocab): def oov(text, vocab):
VerifiedList = [] pass
TextList = text.split(' ')
for TextListElement in TextList:
if TextListElement not in vocab:
VerifiedList.append(TextListElement)
return VerifiedList
def tests(f): def tests(f):

View File

@ -7,16 +7,8 @@ Jeśli podany argument jest mniejszy od 1 powinna być zwracana wartość 0.
""" """
def sum_from_one_to_n(n): def sum_from_one_to_n(n):
ResultList = [] pass
if n <1:
#ResultList.append(0)
SumResult = 0
else:
SumResult = 0
for i in range(n+1):
SumResult = SumResult + i
#ResultList.append(SumResult)
return SumResult
def tests(f): def tests(f):
inputs = [[999], [-100]] inputs = [[999], [-100]]

View File

@ -10,12 +10,7 @@ np. odległość pomiędzy punktami (0, 0, 0) i (3, 4, 0) jest równa 5.
""" """
def euclidean_distance(x, y): def euclidean_distance(x, y):
l = [x,y] pass
edl = []
for c1 in range(3):
edl.append(l[0][c1] - l[1][c1])
edl2 = [i**2 for i in edl]
return ( sum(edl2) ) ** 0.5
def tests(f): def tests(f):
inputs = [[(2.3, 4.3, -7.5), (2.3, 8.5, -7.5)]] inputs = [[(2.3, 4.3, -7.5), (2.3, 8.5, -7.5)]]

View File

@ -10,14 +10,7 @@ ma być zwracany napis "It's not a Big 'No!'".
""" """
def big_no(n): def big_no(n):
if n < 5: pass
res = "It's not a Big 'No!'"
else:
ol = ""
for i in range(n):
ol += "O"
res = "N" + ol + "!"
return(res)
def tests(f): def tests(f):
inputs = [[5], [6], [2]] inputs = [[5], [6], [2]]

View File

@ -6,10 +6,7 @@ Napisz funkcję char_sum, która dla zadanego łańcucha zwraca
sumę kodów ASCII znaków. sumę kodów ASCII znaków.
""" """
def char_sum(text): def char_sum(text):
res = 0 pass
for i in text:
res += ord(i)
return res
def tests(f): def tests(f):
inputs = [["this is a string"], ["this is another string"]] inputs = [["this is a string"], ["this is another string"]]

View File

@ -7,11 +7,7 @@ przez 3 lub 5 mniejszych niż n.
""" """
def sum_div35(n): def sum_div35(n):
res = 0 pass
for i in range(n):
if i % 3 == 0 or i % 5 == 0:
res += i
return res
def tests(f): def tests(f):
inputs = [[10], [100], [3845]] inputs = [[10], [100], [3845]]

View File

@ -9,12 +9,7 @@ Np. leet('leet') powinno zwrócić '1337'.
def leet_speak(text): def leet_speak(text):
text1=text pass
text1=text1.replace("e","3")
text1=text1.replace("l","1")
text1=text1.replace("o","0")
text1=text1.replace("t","7")
return text1
def tests(f): def tests(f):

View File

@ -9,15 +9,8 @@ na wielką. Np. pokemon_speak('pokemon') powinno zwrócić 'PoKeMoN'.
def pokemon_speak(text): def pokemon_speak(text):
res = "" pass
c = 1
for i in text:
if c%2 == 0:
res += i
else:
res += i.upper()
c += 1
return res
def tests(f): def tests(f):
inputs = [['pokemon'], ['do not want'], ['POKEMON']] inputs = [['pokemon'], ['do not want'], ['POKEMON']]
@ -30,4 +23,4 @@ def tests(f):
return "TESTS PASSED" return "TESTS PASSED"
if __name__ == "__main__": if __name__ == "__main__":
print(tests(pokemon_speak)) print(tests(pokemon_speak))

View File

@ -9,18 +9,7 @@ Oba napisy będą składać się wyłacznie z małych liter.
""" """
def common_chars(string1, string2): def common_chars(string1, string2):
sl = [] pass
for i in string1:
for j in string2:
if i==j:
sl.append(i)
sly = [x for x in sl if x != ' ']
sly.sort()
slz = []
for z in sly:
if z not in slz:
slz.append(z)
return slz
def tests(f): def tests(f):

View File

View File

@ -1,6 +0,0 @@
a =[1,2,3,4,5]
b='asdf'
c=0.5
print(id(a))
print(id(b))
print(id(c))

View File

@ -1,10 +0,0 @@
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)

View File

@ -1,4 +0,0 @@
import requests
r = requests.get('https://api.fixer.io/latest')
j=r.json()
print(j['rates']['PLN'])

View File

@ -1,29 +0,0 @@
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)))

View File

@ -1,20 +0,0 @@
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)

View File

@ -1,12 +1,3 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#e
def is_numeric(InputList):
OutputLits = []
for i in range(len(InputList)):
t = InputList[i]
OutputLits.append(isinstance(t,(int, float)))
#print(isinstance(x,(int, float)))
return OutputLits
print(is_numeric([-1,2.4,6]))

View File

@ -1,28 +1,3 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
class Employee:
_id = 0
def __init__(self, name, surname):
Employee._id += 1
self.id = Employee._id
self.name = name
self.surname = surname
def get_id(self):
return self.id
class Recruiter(Employee):
recruited = []
def recruit(self, Employee):
emp_id = Employee.id
self.recruited.append(emp_id)
class Programmer(Employee):
def __init__(self, name, surname, Recruiter):
super().__init__(name, surname)
self.recruiter = Recruiter.id

View File

@ -1,37 +1,3 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
def is_numeric(InputList):
OutputLits = []
for i in range(len(InputList)):
t = InputList[i]
OutputLits.append(isinstance(t,(int, float)))
#print(isinstance(x,(int, float)))
return OutputLits
class Point:
def __add__(self, other):
if len(self.cor)!=len(other.cor):
raise DimensionError("DimesnsionError")
else:
return [i+j for (i,j) in zip(self.cor,other.cor)]
def __init__(self, cor):
if (is_numeric(cor)):
self.cor=cor
else:
raise Exception("Wrong input")
def __len__(self):
return len(self.cor)
def __str__(self):
return(str(self.cor))
def __to_string__(self):
return(str(self.cor))
class DimensionError(Exception):
def __init__(self, text):
self.text = text
def __str__(self):
return self.text
test=Point([2,5])
print(str(test))
print(len(test))

View File

@ -5,11 +5,9 @@ import lib
import tools.fib import tools.fib
import sys import sys
import sys
sys.path.append("..")
# sys.path.append("/ssdfa/fsdsfd/sfd/")
import labs02.task01 # sys.path.append("..")
# import labs02.task01
def main(): def main():
print("Hello World") print("Hello World")

View File

@ -2,10 +2,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
def suma(liczby): def suma(liczby):
return sum(liczby) pass
def main(): def main():
print(suma([1, 2, 3, 4])) print(summa([1, 2, 3, 4]))
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

@ -1,4 +0,0 @@
import task00 as t
import sys
print(t.suma([3.2,4.5]))
print(sys.argv)

View File

@ -1 +0,0 @@
import pandas as pd

View File

@ -1,27 +1,14 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import pandas as pd
import sys
import numpy as np
def wczytaj_dane(): def wczytaj_dane():
my_data = pd.read_csv('mieszkania.csv', pass
encoding='utf-8',
index_col='Id',
sep = ',')
return my_data
#print(my_data)
def most_common_room_number(dane): def most_common_room_number(dane):
rooms = dane['Rooms'] pass
rooms_max = rooms.value_counts().index[0]
return rooms_max
#return ( room_num_list[room_num_list.index(max(room_num_list))] )
#pass
def cheapest_flats(dane, n): def cheapest_flats(dane, n):
expected = dane['Expected'] pass
n_cheapest = expected.sort_values().head(n)
return n_cheapest
def find_borough(desc): def find_borough(desc):
dzielnice = ['Stare Miasto', dzielnice = ['Stare Miasto',
@ -32,27 +19,23 @@ def find_borough(desc):
'Winogrady', 'Winogrady',
'Miłostowo', 'Miłostowo',
'Dębiec'] 'Dębiec']
for dzielnica in dzielnice: pass
if dzielnica in desc:
return dzielnica
return 'Inne'
def add_borough(dane): def add_borough(dane):
dane['Borough'] = dane.apply(lambda row: find_borough(row['Location'])) pass
def write_plot(dane, filename): def write_plot(dane, filename):
dane['Borough'].value_counts().plot.bar().get_figure().savefig(filename) pass
def mean_price(dane, room_number): def mean_price(dane, room_number):
mean_value = dane.loc[dane['Rooms'] == room_number]['Expected'].mean() pass
return mean_value
def find_13(dane): def find_13(dane):
return dane.loc[dane['Floor'] == 13]['Borough'].unique() pass
def find_best_flats(dane): def find_best_flats(dane):
best_flats = dane.loc[(df['Borough'] == 'Winogrady') & (dane['Rooms'] == 3) & (dane['Floor'] == 1)] pass
return best_flats
def main(): def main():
dane = wczytaj_dane() dane = wczytaj_dane()
@ -62,7 +45,7 @@ def main():
.format(most_common_room_number(dane))) .format(most_common_room_number(dane)))
print("{} to najłądniejsza dzielnica w Poznaniu." print("{} to najłądniejsza dzielnica w Poznaniu."
.format(find_borough("Grunwald i Jeżyce"))) .format(find_borough("Grunwald i Jeżyce"))))
print("Średnia cena mieszkania 3-pokojowego, to: {}" print("Średnia cena mieszkania 3-pokojowego, to: {}"
.format(mean_price(dane, 3))) .format(mean_price(dane, 3)))