forked from tdwojak/Python2017
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
a0fecba5c4 | |||
26afa652a5 | |||
f61d161938 | |||
5d25e165c4 | |||
dc5fb3f34b | |||
fd67d4b96f | |||
1599eb71ba | |||
524eefe436 | |||
7ef244fb88 | |||
d8025c91ff | |||
378fee7582 |
@ -1,24 +1,38 @@
|
||||
ID | labs02:task07 | labs02:task08 | labs02:task09 | labs02:task10 | labs02:task11
|
||||
---------|-----------------|-----------------|-----------------|-----------------|---------------
|
||||
s45168 | 0 | 0 | 0 | 0 | 0
|
||||
s45162 | 1 | 1 | 1 | 1 | 1
|
||||
s45158 | 1 | 1 | 0 | 0 | 1
|
||||
szwedek | 1 | 1 | 1 | 1 | 1
|
||||
s45155 | 1 | 1 | 1 | 1 | 1
|
||||
s45152 | 1 | 1 | 1 | 0 | 1
|
||||
s45148 | 1 | 1 | 1 | 1 | 1
|
||||
s45166 | 1 | 1 | 1 | 1 | 1
|
||||
s45151 | 1 | 1 | 1 | 1 | 1
|
||||
s45146 | 1 | 1 | 1 | 1 | 1
|
||||
s45150 | 1 | 1 | 1 | 1 | 1
|
||||
s45452 | 1 | 1 | 1 | 1 | 1
|
||||
s45165 | 1 | 1 | 1 | 1 | 1
|
||||
s45160 | 1 | 1 | 1 | 1 | 1
|
||||
s45153 | 0 | 0 | 0 | 0 | 0
|
||||
s45156 | 1 | 1 | 1 | 1 | 1
|
||||
s45157 | 0 | 0 | 1 | 1 | 1
|
||||
s45167 | 1 | 1 | 1 | 1 | 1
|
||||
s45147 | 1 | 0 | 0 | 1 | 0
|
||||
s45159 | 0 | 0 | 0 | 0 | 0
|
||||
s45161 | 1 | 1 | 1 | 1 | 1
|
||||
s45164 | 1 | 1 | 0 | 1 | 0
|
||||
ID | labs02:task07 | labs02:task08 | labs02:task09 | labs02:task10 | labs02:task11 | labs03 | labs04 | labs06 | Punkty | Ocena |
|
||||
---------|-----------------|-----------------|-----------------|-----------------|-----------------|----------|----------|----------|--------|-------|
|
||||
s45146 | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 8 | 22 | 5 |
|
||||
s45147 | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 8 | 22 | 5 |
|
||||
s45148 | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 8 | 22 | 5 |
|
||||
s45150 | 1 | 1 | 1 | 1 | 1 | 2 | 1 | 8 | 16 | 4 |
|
||||
s45151 | 1 | 1 | 1 | 1 | 1 | 0 | 5 | 8 | 18 | 4.5 |
|
||||
s45152 | 1 | 1 | 1 | 0 | 1 | 0 | 5 | 8 | 17 | 4 |
|
||||
s45153 | 0 | 1 | 1 | 1 | 1 | 4 | 0 | 8 | 16 | 4 |
|
||||
s45155 | 1 | 1 | 1 | 1 | 1 | 1 | 5 | 8 | 19 | 4.5 |
|
||||
s45156 | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 8 | 22 | 5 |
|
||||
s45157 | 1 | 1 | 1 | 1 | 1 | 4 | 4 | 8 | 21 | 5 |
|
||||
s45158 | 1 | 1 | 0 | 0 | 1 | 4 | 5 | 8 | 19 | 4.5 |
|
||||
s45159 | 1 | 1 | 1 | 1 | 1 | 2 | 3 | 8 | 18 | 4.5 |
|
||||
s45160 | 1 | 1 | 1 | 1 | 1 | 4 | 4 | 8 | 21 | 5 |
|
||||
s45161 | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 8 | 22 | 5 |
|
||||
s45162 | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 8 | 22 | 5 |
|
||||
s45163 | 1 | 1 | 1 | 1 | 1 | 4 | 4 | 8 | 21 | 5 |
|
||||
s45164 | 1 | 1 | 0 | 1 | 0 | 0 | 5 | 8 | 16 | 4 |
|
||||
s45165 | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 8 | 22 | 5 |
|
||||
s45166 | 1 | 1 | 1 | 1 | 1 | 4 | 5 | 8 | 22 | 5 |
|
||||
s45167 | 1 | 1 | 1 | 1 | 1 | 0 | 5 | 8 | 17 | 4 |
|
||||
s45168 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
|
||||
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
|
||||
|
@ -7,7 +7,7 @@ która zawiera tylko elementy z list o parzystych indeksach.
|
||||
"""
|
||||
|
||||
def even_elements(lista):
|
||||
return lista[::2]
|
||||
pass
|
||||
|
||||
|
||||
def tests(f):
|
||||
|
@ -5,14 +5,9 @@
|
||||
Napisz funkcję days_in_year zwracającą liczbę dni w roku (365 albo 366).
|
||||
"""
|
||||
|
||||
def days_in_year(year):
|
||||
if year % 4 == 0:
|
||||
if year % 100 > 0 or year % 400 == 0:
|
||||
return 366
|
||||
else:
|
||||
return 365
|
||||
else:
|
||||
return 365
|
||||
def days_in_year(days):
|
||||
pass
|
||||
|
||||
def tests(f):
|
||||
inputs = [[2015], [2012], [1900], [2400], [1977]]
|
||||
outputs = [365, 366, 365, 366, 365]
|
||||
|
@ -13,12 +13,8 @@ jak 'set', która przechowuje elementy bez powtórzeń.)
|
||||
|
||||
|
||||
def oov(text, vocab):
|
||||
VerifiedList = []
|
||||
TextList = text.split(' ')
|
||||
for TextListElement in TextList:
|
||||
if TextListElement not in vocab:
|
||||
VerifiedList.append(TextListElement)
|
||||
return VerifiedList
|
||||
pass
|
||||
|
||||
|
||||
|
||||
def tests(f):
|
||||
|
@ -7,16 +7,8 @@ Jeśli podany argument jest mniejszy od 1 powinna być zwracana wartość 0.
|
||||
"""
|
||||
|
||||
def sum_from_one_to_n(n):
|
||||
ResultList = []
|
||||
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
|
||||
pass
|
||||
|
||||
|
||||
def tests(f):
|
||||
inputs = [[999], [-100]]
|
||||
|
@ -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):
|
||||
l = [x,y]
|
||||
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
|
||||
pass
|
||||
|
||||
def tests(f):
|
||||
inputs = [[(2.3, 4.3, -7.5), (2.3, 8.5, -7.5)]]
|
||||
|
@ -10,14 +10,7 @@ ma być zwracany napis "It's not a Big 'No!'".
|
||||
"""
|
||||
|
||||
def big_no(n):
|
||||
if n < 5:
|
||||
res = "It's not a Big 'No!'"
|
||||
else:
|
||||
ol = ""
|
||||
for i in range(n):
|
||||
ol += "O"
|
||||
res = "N" + ol + "!"
|
||||
return(res)
|
||||
pass
|
||||
|
||||
def tests(f):
|
||||
inputs = [[5], [6], [2]]
|
||||
|
@ -6,10 +6,7 @@ Napisz funkcję char_sum, która dla zadanego łańcucha zwraca
|
||||
sumę kodów ASCII znaków.
|
||||
"""
|
||||
def char_sum(text):
|
||||
res = 0
|
||||
for i in text:
|
||||
res += ord(i)
|
||||
return res
|
||||
pass
|
||||
|
||||
def tests(f):
|
||||
inputs = [["this is a string"], ["this is another string"]]
|
||||
|
@ -7,11 +7,7 @@ przez 3 lub 5 mniejszych niż n.
|
||||
"""
|
||||
|
||||
def sum_div35(n):
|
||||
res = 0
|
||||
for i in range(n):
|
||||
if i % 3 == 0 or i % 5 == 0:
|
||||
res += i
|
||||
return res
|
||||
pass
|
||||
|
||||
def tests(f):
|
||||
inputs = [[10], [100], [3845]]
|
||||
|
@ -9,12 +9,7 @@ Np. leet('leet') powinno zwrócić '1337'.
|
||||
|
||||
|
||||
def leet_speak(text):
|
||||
text1=text
|
||||
text1=text1.replace("e","3")
|
||||
text1=text1.replace("l","1")
|
||||
text1=text1.replace("o","0")
|
||||
text1=text1.replace("t","7")
|
||||
return text1
|
||||
pass
|
||||
|
||||
|
||||
def tests(f):
|
||||
|
@ -9,15 +9,8 @@ na wielką. Np. pokemon_speak('pokemon') powinno zwrócić 'PoKeMoN'.
|
||||
|
||||
|
||||
def pokemon_speak(text):
|
||||
res = ""
|
||||
c = 1
|
||||
for i in text:
|
||||
if c%2 == 0:
|
||||
res += i
|
||||
else:
|
||||
res += i.upper()
|
||||
c += 1
|
||||
return res
|
||||
pass
|
||||
|
||||
|
||||
def tests(f):
|
||||
inputs = [['pokemon'], ['do not want'], ['POKEMON']]
|
||||
|
@ -9,18 +9,7 @@ Oba napisy będą składać się wyłacznie z małych liter.
|
||||
"""
|
||||
|
||||
def common_chars(string1, string2):
|
||||
sl = []
|
||||
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
|
||||
pass
|
||||
|
||||
|
||||
def tests(f):
|
||||
|
@ -1,6 +0,0 @@
|
||||
a =[1,2,3,4,5]
|
||||
b='asdf'
|
||||
c=0.5
|
||||
print(id(a))
|
||||
print(id(b))
|
||||
print(id(c))
|
@ -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)
|
@ -1,4 +0,0 @@
|
||||
import requests
|
||||
r = requests.get('https://api.fixer.io/latest')
|
||||
j=r.json()
|
||||
print(j['rates']['PLN'])
|
@ -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)))
|
||||
|
@ -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)
|
@ -1,12 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# -*- 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]))
|
@ -1,28 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# -*- 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
|
@ -1,37 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# -*- 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))
|
||||
|
@ -5,11 +5,9 @@ import lib
|
||||
import tools.fib
|
||||
|
||||
import sys
|
||||
import sys
|
||||
sys.path.append("..")
|
||||
# sys.path.append("/ssdfa/fsdsfd/sfd/")
|
||||
|
||||
import labs02.task01
|
||||
# sys.path.append("..")
|
||||
# import labs02.task01
|
||||
|
||||
def main():
|
||||
print("Hello World")
|
||||
|
@ -2,10 +2,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
def suma(liczby):
|
||||
return sum(liczby)
|
||||
pass
|
||||
|
||||
def main():
|
||||
print(suma([1, 2, 3, 4]))
|
||||
print(summa([1, 2, 3, 4]))
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -1,4 +0,0 @@
|
||||
import task00 as t
|
||||
import sys
|
||||
print(t.suma([3.2,4.5]))
|
||||
print(sys.argv)
|
@ -1 +0,0 @@
|
||||
import pandas as pd
|
@ -1,27 +1,14 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import pandas as pd
|
||||
import sys
|
||||
import numpy as np
|
||||
|
||||
def wczytaj_dane():
|
||||
my_data = pd.read_csv('mieszkania.csv',
|
||||
encoding='utf-8',
|
||||
index_col='Id',
|
||||
sep = ',')
|
||||
return my_data
|
||||
#print(my_data)
|
||||
pass
|
||||
|
||||
def most_common_room_number(dane):
|
||||
rooms = dane['Rooms']
|
||||
rooms_max = rooms.value_counts().index[0]
|
||||
return rooms_max
|
||||
#return ( room_num_list[room_num_list.index(max(room_num_list))] )
|
||||
#pass
|
||||
pass
|
||||
|
||||
def cheapest_flats(dane, n):
|
||||
expected = dane['Expected']
|
||||
n_cheapest = expected.sort_values().head(n)
|
||||
return n_cheapest
|
||||
pass
|
||||
|
||||
def find_borough(desc):
|
||||
dzielnice = ['Stare Miasto',
|
||||
@ -32,27 +19,23 @@ def find_borough(desc):
|
||||
'Winogrady',
|
||||
'Miłostowo',
|
||||
'Dębiec']
|
||||
for dzielnica in dzielnice:
|
||||
if dzielnica in desc:
|
||||
return dzielnica
|
||||
return 'Inne'
|
||||
pass
|
||||
|
||||
|
||||
def add_borough(dane):
|
||||
dane['Borough'] = dane.apply(lambda row: find_borough(row['Location']))
|
||||
pass
|
||||
|
||||
def write_plot(dane, filename):
|
||||
dane['Borough'].value_counts().plot.bar().get_figure().savefig(filename)
|
||||
pass
|
||||
|
||||
def mean_price(dane, room_number):
|
||||
mean_value = dane.loc[dane['Rooms'] == room_number]['Expected'].mean()
|
||||
return mean_value
|
||||
pass
|
||||
|
||||
def find_13(dane):
|
||||
return dane.loc[dane['Floor'] == 13]['Borough'].unique()
|
||||
pass
|
||||
|
||||
def find_best_flats(dane):
|
||||
best_flats = dane.loc[(df['Borough'] == 'Winogrady') & (dane['Rooms'] == 3) & (dane['Floor'] == 1)]
|
||||
return best_flats
|
||||
pass
|
||||
|
||||
def main():
|
||||
dane = wczytaj_dane()
|
||||
@ -62,7 +45,7 @@ def main():
|
||||
.format(most_common_room_number(dane)))
|
||||
|
||||
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: {}"
|
||||
.format(mean_price(dane, 3)))
|
||||
|
Loading…
Reference in New Issue
Block a user