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
30 changed files with 95 additions and 304 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

@ -6,7 +6,7 @@
""" """
def days_in_year(days): def days_in_year(days):
return 366 if ((days % 4 == 0) and (days % 100 != 0)) or (days % 400 == 0) else 365 pass
def tests(f): def tests(f):
inputs = [[2015], [2012], [1900], [2400], [1977]] inputs = [[2015], [2012], [1900], [2400], [1977]]

View File

@ -13,7 +13,8 @@ jak 'set', która przechowuje elementy bez powtórzeń.)
def oov(text, vocab): def oov(text, vocab):
return set(text.split(' ')).difference(vocab) pass
def tests(f): def tests(f):
@ -27,6 +28,5 @@ def tests(f):
break break
return "TESTS PASSED" return "TESTS PASSED"
if __name__ == "__main__": if __name__ == "__main__":
print(tests(oov)) print(tests(oov))

View File

@ -7,7 +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):
return 0 if n < 1 else reduce(lambda x, y: (x+y), range(1,n+1)) pass
def tests(f): def tests(f):
inputs = [[999], [-100]] inputs = [[999], [-100]]

View File

@ -8,13 +8,9 @@ dwoma punktami przestrzeni trójwymiarowej. Punkty są dane jako
trzyelementowe listy liczb zmiennoprzecinkowych. trzyelementowe listy liczb zmiennoprzecinkowych.
np. odległość pomiędzy punktami (0, 0, 0) i (3, 4, 0) jest równa 5. np. odległość pomiędzy punktami (0, 0, 0) i (3, 4, 0) jest równa 5.
""" """
import math
def euclidean_distance(x, y): def euclidean_distance(x, y):
return math.sqrt(math.sqrt((y[0] - x[0]) ** 2 + (y[1] - x[1]) ** 2) ** 2 + (y[2] - x[2]) ** 2) pass
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

@ -9,10 +9,8 @@ równa podanemu argumentem, przy czym jeśli argument jest mniejszy niż 5,
ma być zwracany napis "It's not a Big 'No!'". ma być zwracany napis "It's not a Big 'No!'".
""" """
def big_no(n): def big_no(n):
return "It's not a Big 'No!'" if n < 5 else "N" + n * "O" + "!" pass
def tests(f): def tests(f):
inputs = [[5], [6], [2]] inputs = [[5], [6], [2]]
@ -24,6 +22,5 @@ def tests(f):
break break
return "TESTS PASSED" return "TESTS PASSED"
if __name__ == "__main__": if __name__ == "__main__":
print(tests(big_no)) print(tests(big_no))

View File

@ -6,7 +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):
return reduce(lambda x, y: (x + y), map(lambda ch: ord(ch), text)) pass
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,7 +7,7 @@ przez 3 lub 5 mniejszych niż n.
""" """
def sum_div35(n): def sum_div35(n):
return reduce(lambda x, y: (x + y), filter(lambda x: (x%3==0 or x%5==0), range(1,n))) pass
def tests(f): def tests(f):
inputs = [[10], [100], [3845]] inputs = [[10], [100], [3845]]

View File

@ -9,7 +9,7 @@ Np. leet('leet') powinno zwrócić '1337'.
def leet_speak(text): def leet_speak(text):
return ''.join(map( lambda ch: {'e': '3', 'l': '1', 'o': '0', 't': '7'}.get(ch, ch), text)) pass
def tests(f): def tests(f):

View File

@ -9,7 +9,7 @@ na wielką. Np. pokemon_speak('pokemon') powinno zwrócić 'PoKeMoN'.
def pokemon_speak(text): def pokemon_speak(text):
return ''.join([a if idx%2==1 else a.upper() for idx, a in enumerate(text)]) pass
def tests(f): def tests(f):

View File

@ -9,7 +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):
return sorted( set(filter(lambda ch: ch.islower(), string1)).intersection(filter(lambda ch: ch.islower(), string2)) ) pass
def tests(f): def tests(f):

View File

@ -3,6 +3,9 @@
def suma(a, b): def suma(a, b):
"""
Napisz funkcję, która zwraca sumę elementów.
"""
return a + b return a + b
def tests(f): def tests(f):
@ -15,5 +18,4 @@ def tests(f):
break break
return "TESTS PASSED" return "TESTS PASSED"
if __name__ == "__main__":
print(tests(suma)) print(tests(suma))

View File

@ -6,9 +6,7 @@
Sklonuj repozytorium ``https://github.com/realpython/python-scripts``, które różne, przydatne skrypty. Przejrzyj je i zobacz na ile jesteś w stanie zrozumieć co i jak robią. Uruchom kilka z nich, np. ``27_send_sms.py``. Sklonuj repozytorium ``https://github.com/realpython/python-scripts``, które różne, przydatne skrypty. Przejrzyj je i zobacz na ile jesteś w stanie zrozumieć co i jak robią. Uruchom kilka z nich, np. ``27_send_sms.py``.
**ćwiczenie 1** **ćwiczenie 1**
Każdy obiekt w Pythonie na wbudowaną funkcję ``id()``, która zwraca liczbę, która jest unikatowa i stała dla obiektu. Każdy obiekt w Pythonie na wbudowaną funkcję ``id()``, która zwraca liczbę, która jest unikatowa i stała dla obiektu. Pozwala ona w prosty sposób sprawdzić, który obiekt jest *mutable*a, który *immutable*: jeżeli po wykonaniu operacji, zwracana liczba jest stała, to oznacza, że obiekt jest *mutable*. Sprawdź zachowanie funkcji na obiektach typy:
Pozwala ona w prosty sposób sprawdzić, który obiekt jest *mutable*a, który *immutable*: jeżeli po wykonaniu operacji,
zwracana liczba jest stała, to oznacza, że obiekt jest *mutable*. Sprawdź zachowanie funkcji na obiektach typy:
* lista, * lista,
* napis (string), * napis (string),
* liczba zmiennoprzecinkowa. * liczba zmiennoprzecinkowa.

View File

@ -1,8 +0,0 @@
#lab03 task01
#Returns mutable type names
[t for t, oldid, newid in map( lambda (t, obj, objid): (t, id(obj*1), objid), map(lambda x : (type(x), x, id(x)), [[], '', 3.141592]) ) if oldid == newid]
for type_name, type_mutable in map( lambda t: (type(t), id(t)==id(t*1)), [[], '', 3.141592] ):
print("%s is %s" % (str(type_name), 'mutable' if type_mutable else 'immutable') )

View File

@ -1,7 +0,0 @@
# lab03, task02
def fibN(n):
prev, current = 1, 1
for n in range(n):
yield prev
prev, current = current, prev + current

View File

@ -1,15 +0,0 @@
# -*- coding: utf-8 -*-
import requests, json
# try:
# print('EUR:PLN %3.4f' % (requests.get('https://api.fixer.io/latest').json()['rates']['PLN']))
# except:
# print("Something went wrong. Couldn't display EUR:PLN exchange rate.")
#
# Niestety nie znalazłem w pakiecie json dla pythona 2.7 operacji zwracającej wspomniany w treści zadania
# 'obiekt typu JSON' -czytanie streamu zamienia dane na zwykłe pythonowe słowniki. Nie wnosi to więc wartości dodanej
# do powyższego kodu, który w metodzie.json() zwraca obiekt typu dict, podobnie jak przyjmująca łańcuch znaków
# funkcja json.loads.
print(json.loads(requests.get('https://api.fixer.io/latest').text))['rates']['PLN']
# assert type(json.loads(requests.get('https://api.fixer.io/latest').text)) == type(dict())
#

View File

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
from weather import Weather
import datetime
weather = Weather()
loc = weather.lookup_by_location('Poznan')
print('Informacja o aktualnej pogodzie: %s' % loc.condition().text())
def ftoc(f):
return (f-32.0)*5.0/9.0
def date_to_pl_weekday(date_string):
"""
input: string of form '10 Dec 2017'
output: weekday in polish language
"""
idx = datetime.datetime.strptime(date_string, '%d %b %Y').weekday()
return [u'poniedziałek', u'wtorek', u'środa', u'czwartek', u'piątek', u'sobota', u'niedziela'][idx]
min_day = min(loc.forecast(), key = lambda f: f.low())
print(u'Najbliższy najzimniejszy dzień to %s. Będzie %s\u00B0C. ' % (date_to_pl_weekday(min_day.date()), ftoc(int(min_day.low()))))

View File

@ -1,18 +0,0 @@
import glob, os
# print(glob.glob('./scores/model.iter[0-9][0-9][0-9][0-9][0-9][0-9][0-9].npz.bleu'))
def extract_BLEU_score(fn):
'''
:param fn - path to file with :
:return:
'''
with open(fn, 'r') as fd:
line = fd.readline()
return (os.path.abspath(fn), float(line[6:line.index(',')]))
print max([ t for t in map(extract_BLEU_score, glob.iglob('./scores/model.iter[0-9][0-9][0-9][0-9][0-9]*.npz.bleu'))], key = lambda tpl: tpl[1])[0]

View File

View File

@ -1,19 +1,3 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
def is_numeric(xs):
return all(isinstance(x, (int, float)) for x in xs)
assert is_numeric([1,2,3,4,5,6,6])
assert is_numeric([1.0,2.0,3.0,4.0,5.0,6.0])
assert is_numeric([1])
assert is_numeric([1.0])
assert is_numeric([1.0, 1])
assert is_numeric([1, 1.0])
assert is_numeric([]) #zgodnie z ustaleniami z zajęć
assert not is_numeric([1,2,3,'a',4,5,6,6])
assert not is_numeric([1.0,2.0,3.0,'a',4.0,5.0,6.0])
assert not is_numeric([1, 'a'])
assert not is_numeric([1.0, 'a'])
assert not is_numeric(['a', 1.0, 1])
assert not is_numeric([1, 1.0, 'a'])
assert not is_numeric(['a'])

View File

@ -1,38 +1,3 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
class Employee(object):
NEXT_ID = 0
def __init__(self, name, surname):
self.name = name
self.surname = surname
self.id = Employee.NEXT_ID
Employee.NEXT_ID = Employee.NEXT_ID + 1
def get_id(self):
return self.id
class Recruiter(Employee):
def __init__(self, name, surname):
super(Recruiter, self).__init__(name, surname)
self.recruited = []
def recruit(self, employee):
self.recruited.append(employee.get_id())
class Programmer(Employee):
def __init__(self, name, surname, recruiter):
super(Programmer, self).__init__(name, surname)
self.recruiter = recruiter.get_id()
empl1 = Employee('a', 'a')
empl2 = Employee('b', 'b')
rec1 = Recruiter('c', 'c')
prog1 = Programmer('d', 'd', rec1)
rec1.recruit(prog1)
assert prog1.recruiter == rec1.get_id()
assert any( recruitee_id == prog1.get_id() for recruitee_id in rec1.recruited )

View File

@ -1,42 +1,3 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
class Point(object):
def __init__(self, coords):
from labs04.task01 import is_numeric
assert is_numeric(coords)
self.coords = coords
def add(self, that):
if len(self.coords) != len(that.coords):
raise DimensionError('Niezgodne wymiary')
else:
pass
return Point(map(lambda(a,b): a+b, zip(self.coords, that.coords)))
def to_string(self):
return type(self).__name__+'('+((',').join(map(str, self.coords)))+')'
def len(self):
return len(self.coords)
def __len__(self):
return len(self.coords)
def __str__(self):
return self.to_string()
def __add__(self, other):
return self.add(other)
class DimensionError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
pt1 = Point([1,2,3.0,4.0])
pt2 = Point([-1, -2.0, -3, -4.0])
print('len(%s + %s) = %d' %(pt1, pt2, len(pt1 + pt2)))
print(pt1 + pt2)

View File

@ -2,11 +2,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
def suma(liczby): def suma(liczby):
assert len(liczby) > 0 pass
return reduce(lambda a, b: a+b, liczby)
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,7 +0,0 @@
import task00, sys
def main():
print('%f' % (task00.suma(map(lambda x: float(x), sys.argv[1:]))))
if __name__ == '__main__':
main()

View File

@ -1,12 +0,0 @@
import task00, sys
def main():
def a_to_f(a):
try:
return float(a)
except:
return 0
print('%f' % (task00.suma(map(a_to_f, sys.argv[1:]))))
if __name__ == '__main__':
main()

View File

@ -1,15 +0,0 @@
import task00, argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument("numbers", nargs="+")
args = parser.parse_args()
def a_to_f(a):
try:
return float(a)
except:
return 0
print('%f' % (task00.suma(map(a_to_f, args.numbers))))
if __name__ == '__main__':
main()

View File

@ -6,7 +6,7 @@ Implementacja narzedzia ``wc`` z linuksa (word counter).
Zwraca liczbę słów, znaków i linii. Zwraca liczbę słów, znaków i linii.
""" """
import sys, argparse import sys
def count_lines(text): def count_lines(text):
@ -19,7 +19,7 @@ def count_words(text):
for line in text.split('\n')]) for line in text.split('\n')])
def count_chars(text): def count_chars(text):
""" return number of characters. """ """ return number of words. """
return len(text) return len(text)
def wc(text): def wc(text):
@ -32,22 +32,7 @@ def wc(text):
def main(): def main():
""" main """ """ main """
parser = argparse.ArgumentParser() print(wc(sys.stdin.read()))
parser.add_argument('-l', help="number of lines", action="store_true")
parser.add_argument('-w', help="number of words", action="store_true")
parser.add_argument('-c', help="number of characters", action="store_true")
parser.add_argument('fn', nargs='?', type=file, default=sys.stdin, help='optional filename to read from')
args = parser.parse_args()
lines, words, chars = wc(args.fn.read())
if( args.l or args.w or args.c ):
if(args.l):
print(lines)
if(args.w):
print(words)
if(args.c):
print(chars)
else:
print(lines, words, chars)
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -28,7 +28,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 12,
"metadata": { "metadata": {
"collapsed": true, "collapsed": true,
"slideshow": { "slideshow": {
@ -299,12 +299,30 @@
] ]
}, },
{ {
"cell_type": "markdown", "cell_type": "code",
"execution_count": 16,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
} }
}, },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"count 26.000000\n",
"mean 8.576923\n",
"std 5.375300\n",
"min 1.000000\n",
"25% 4.250000\n",
"50% 8.000000\n",
"75% 12.000000\n",
"max 18.000000\n",
"dtype: float64\n"
]
}
],
"source": [ "source": [
"print(dane.describe())" "print(dane.describe())"
] ]

View File

@ -1,15 +1,14 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import pandas as pd
def wczytaj_dane(): def wczytaj_dane():
return pd.read_csv('mieszkania.csv') pass
def most_common_room_number(dane): def most_common_room_number(dane):
return dane['Rooms'].mode()[0] pass
def cheapest_flats(dane, n): def cheapest_flats(dane, n):
return dane.sort_values(by=[u'Expected'], na_position='last').head(n) pass
def find_borough(desc): def find_borough(desc):
dzielnice = ['Stare Miasto', dzielnice = ['Stare Miasto',
@ -20,37 +19,23 @@ def find_borough(desc):
'Winogrady', 'Winogrady',
'Miłostowo', 'Miłostowo',
'Dębiec'] 'Dębiec']
histogram = {districtName: desc.find(districtName) for districtName in dzielnice if desc.find(districtName) != -1} pass
return 'Inne' if not histogram else min(histogram, key=histogram.get)
def add_borough(dane): def add_borough(dane):
dane['Borough'] = dane.apply( lambda row: find_borough( row['Location']), axis = 1) 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):
return dane.loc[ dane['Rooms'] == room_number ].mean()[1] pass
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):
return dane.loc[(dane['Borough'] == 'Winogrady') & (dane['Rooms'] == 3) & (dane['Floor'] == 1)] pass
def predict(dane, rooms, sqrMeters):
from sklearn import linear_model
import numpy as np
data = dane
df = pd.DataFrame(data, columns=np.array(['Rooms','SqrMeters']))
target = pd.DataFrame(data, columns=["Expected"])
X = df
y = target["Expected"]
lm = linear_model.LinearRegression()
model = lm.fit(X, y)
inData = pd.DataFrame.from_records([(rooms, sqrMeters)], columns=['Rooms', 'SqrMeters'])
return lm.predict(inData)[0]
def main(): def main():
dane = wczytaj_dane() dane = wczytaj_dane()
@ -59,21 +44,11 @@ def main():
print("Najpopularniejsza liczba pokoi w mieszkaniu to: {}" print("Najpopularniejsza liczba pokoi w mieszkaniu to: {}"
.format(most_common_room_number(dane))) .format(most_common_room_number(dane)))
print("7 najtańszych mieszkań to: ") print("{} to najłądniejsza dzielnica w Poznaniu."
print(cheapest_flats(dane, 7)) .format(find_borough("Grunwald i Jeżyce"))))
print("{} to najłądniejsza dzielnica w Poznaniu.".format(find_borough("Grunwald i Jeżyce")))
add_borough(dane)
write_plot(dane, 'tmp_borough_hist.png')
for i in dane['Rooms'].unique():
print("Średnia cena mieszkania {}-pokojowego, to: {}".format(i, mean_price(dane, i)))
print('Dzielnice z mieszkaniami na 13 piętrze: {}'.format(find_13(dane)))
print('"Najlepsze" mieszkania: ')
print(find_best_flats(dane))
print('Predicted price(actual 146000): ', predict(dane,1,31.21))
print("Średnia cena mieszkania 3-pokojowego, to: {}"
.format(mean_price(dane, 3)))
if __name__ == "__main__": if __name__ == "__main__":
main() main()