From 4a426797299ee704a71c82b8f407e53e2701578c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrea=20G=C3=B3ralczyk?= Date: Sat, 2 Jun 2018 20:00:58 +0000 Subject: [PATCH 1/6] Update 'labs02/task08.py' --- labs02/task08.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/labs02/task08.py b/labs02/task08.py index 252b10d..654b867 100644 --- a/labs02/task08.py +++ b/labs02/task08.py @@ -7,7 +7,15 @@ przez 3 lub 5 mniejszych niż n. """ def sum_div35(n): - pass + + if n == 0: + return 0 + else: + suma=0 + for i in range(n): + if ((i%3) == 0) or ((i%5) == 0): + suma =suma + i + return suma def tests(f): inputs = [[10], [100], [3845]] From c5944a3f95bbfde4df0472ce271305f1df086710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrea=20G=C3=B3ralczyk?= Date: Sat, 2 Jun 2018 20:02:05 +0000 Subject: [PATCH 2/6] Update 'labs02/task09.py' --- labs02/task09.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/labs02/task09.py b/labs02/task09.py index 9045054..525733f 100644 --- a/labs02/task09.py +++ b/labs02/task09.py @@ -7,10 +7,18 @@ na podobnie wyglądające cyfry: 'e' na '3', 'l' na '1', 'o' na '0', 't' na '7'. Np. leet('leet') powinno zwrócić '1337'. """ - def leet_speak(text): - pass - + + for i in range(len(text)): + if ((text[i]) == 'e'): + text = text[:i] + '3' + text[i + 1:] + elif ((text[i]) == 'l'): + text = text[:i] + '1' + text[i + 1:] + elif ((text[i]) == 'o'): + text = text[:i] + '0' + text[i + 1:] + elif ((text[i]) == 't'): + text = text[:i] + '7' + text[i + 1:] + return text def tests(f): inputs = [['leet'], ['do not want']] From 493056edb6d7d51f686bf209eee07daf09f102ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrea=20G=C3=B3ralczyk?= Date: Sat, 2 Jun 2018 20:03:33 +0000 Subject: [PATCH 3/6] zadanie10 --- labs02/task10.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/labs02/task10.py b/labs02/task10.py index 58d40d2..2dcfcb1 100644 --- a/labs02/task10.py +++ b/labs02/task10.py @@ -9,8 +9,12 @@ na wielką. Np. pokemon_speak('pokemon') powinno zwrócić 'PoKeMoN'. def pokemon_speak(text): - pass + + for i in range(len(text)): + if ((i % 2) == 0): + text = text[:i] + (text[i].upper()) + text[i + 1:] + return text def tests(f): inputs = [['pokemon'], ['do not want'], ['POKEMON']] From 776abbce40a25dda066cf0f827a0f933c3053efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrea=20G=C3=B3ralczyk?= Date: Sat, 2 Jun 2018 20:04:15 +0000 Subject: [PATCH 4/6] rozwiazanie zad11 --- labs02/task11.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/labs02/task11.py b/labs02/task11.py index 7d36767..4bc74a7 100644 --- a/labs02/task11.py +++ b/labs02/task11.py @@ -9,7 +9,24 @@ Oba napisy będą składać się wyłacznie z małych liter. """ def common_chars(string1, string2): - pass + n= string1 + m= string2 + li = [] + if len(n) >= len(m): + for i in range(len(n)): + for j in range(len(m)): + if n[i] == m[j]: + li.append(n[i]) + + else: + for i in range(len(m)): + for j in range(len(n)): + if m[i] == n[j]: + li.append(m[i]) + li = list(set(li)) + li.remove(' ') + li.sort() + return li def tests(f): From 2f180bdafd2f76cc73a03878661d5dfc780fe8e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrea=20G=C3=B3ralczyk?= Date: Sat, 2 Jun 2018 20:23:24 +0000 Subject: [PATCH 5/6] rozwiazanie cw5 --- labs04/cw5.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 labs04/cw5.py diff --git a/labs04/cw5.py b/labs04/cw5.py new file mode 100644 index 0000000..233565b --- /dev/null +++ b/labs04/cw5.py @@ -0,0 +1,17 @@ +import glob + +sciezka = "/home/andrea/Pulpit/scores/model.iter*.npz.bleu" + +for file in glob.glob(sciezka): + with open(file, 'r') as plik: + for line in plik.readlines(): + bleu = float(line[line.find("=")+ 1:line.find(",")]) + if bleu >0: + max = bleu + maxi = file + + plik.close() + +print ( maxi ) + + From 86acfcd66150180f268a823017e9871d22f42b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrea=20G=C3=B3ralczyk?= Date: Sun, 3 Jun 2018 06:21:19 +0000 Subject: [PATCH 6/6] Update 'labs04/cw5.py' --- labs04/cw5.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labs04/cw5.py b/labs04/cw5.py index 233565b..42d3b2d 100644 --- a/labs04/cw5.py +++ b/labs04/cw5.py @@ -1,6 +1,6 @@ import glob -sciezka = "/home/andrea/Pulpit/scores/model.iter*.npz.bleu" +sciezka = "/scores/model.iter*.npz.bleu" for file in glob.glob(sciezka): with open(file, 'r') as plik: