From 3672f3d65e173286c058195660835be553a00235 Mon Sep 17 00:00:00 2001 From: Justyna Adamczyk Date: Tue, 22 May 2018 18:40:20 +0000 Subject: [PATCH 1/8] Zaktualizuj 'labs02/task06.py' dodaje --- labs02/task06.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/labs02/task06.py b/labs02/task06.py index ff4a9d3..a9d1c33 100644 --- a/labs02/task06.py +++ b/labs02/task06.py @@ -10,7 +10,15 @@ ma być zwracany napis "It's not a Big 'No!'". """ def big_no(n): - pass + if n<5: + zdanie="It's not a Big 'No!'" + else: + zdanie='N' + for i in range(n): + zdanie=zdanie + 'O' + zdanie = zdanie+'!' + + return zdanie def tests(f): inputs = [[5], [6], [2]] From a4b330b3b05cdeb7009e610ed48cbc4d3ff01f0f Mon Sep 17 00:00:00 2001 From: Justyna Adamczyk Date: Tue, 22 May 2018 19:09:50 +0000 Subject: [PATCH 2/8] =?UTF-8?q?jeszcze=20b=C4=99de=20poprawia=C4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- labs02/task08.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/labs02/task08.py b/labs02/task08.py index 252b10d..dc4f3f8 100644 --- a/labs02/task08.py +++ b/labs02/task08.py @@ -7,7 +7,14 @@ przez 3 lub 5 mniejszych niż n. """ def sum_div35(n): - pass + suma = 0 + i=1 + for i in range(n-1): + if (i%3 or i%5): + suma = suma + i + + return suma +#jeszcze jest źle def tests(f): inputs = [[10], [100], [3845]] From 56c08684b98af15b53ca4cf427500a005c9d4810 Mon Sep 17 00:00:00 2001 From: Justyna Adamczyk Date: Wed, 23 May 2018 17:41:29 +0000 Subject: [PATCH 3/8] zrobione --- labs02/task08.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/labs02/task08.py b/labs02/task08.py index dc4f3f8..0512e58 100644 --- a/labs02/task08.py +++ b/labs02/task08.py @@ -8,9 +8,8 @@ przez 3 lub 5 mniejszych niż n. def sum_div35(n): suma = 0 - i=1 for i in range(n-1): - if (i%3 or i%5): + if (i%3==0) or (i%5==0): suma = suma + i return suma From e02cffd23033875981a769c760eda95e3aebfda1 Mon Sep 17 00:00:00 2001 From: Justyna Adamczyk Date: Wed, 23 May 2018 17:41:45 +0000 Subject: [PATCH 4/8] zrobione --- labs02/task08.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labs02/task08.py b/labs02/task08.py index 0512e58..7708f2c 100644 --- a/labs02/task08.py +++ b/labs02/task08.py @@ -13,7 +13,7 @@ def sum_div35(n): suma = suma + i return suma -#jeszcze jest źle + def tests(f): inputs = [[10], [100], [3845]] From 655c576a5a7e780b62a632585ab5b968e39d8ec9 Mon Sep 17 00:00:00 2001 From: Justyna Adamczyk Date: Thu, 31 May 2018 17:59:29 +0000 Subject: [PATCH 5/8] zrobione zad 9 --- labs02/task09.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/labs02/task09.py b/labs02/task09.py index 9045054..8ffb44c 100644 --- a/labs02/task09.py +++ b/labs02/task09.py @@ -9,7 +9,8 @@ Np. leet('leet') powinno zwrócić '1337'. def leet_speak(text): - pass + return tekst.replace('o', '0').replace('l', '1').replace('e', '3').replace('t', '7') + def tests(f): From 74f9c6a5e5ab58588a7eb539093fe78810079593 Mon Sep 17 00:00:00 2001 From: Justyna Adamczyk Date: Thu, 31 May 2018 18:28:58 +0000 Subject: [PATCH 6/8] zrobione zad 10 --- labs02/task10.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/labs02/task10.py b/labs02/task10.py index 58d40d2..1b140ab 100644 --- a/labs02/task10.py +++ b/labs02/task10.py @@ -7,10 +7,17 @@ Napisz funkcję pokemon_speak, która zamienia w podanym napisie co drugą liter na wielką. Np. pokemon_speak('pokemon') powinno zwrócić 'PoKeMoN'. """ - def pokemon_speak(text): - pass + listy = [] + for i in range(len(text)): + if i % 2 == 0: + listy.append(text[i].upper()) + else: + listy.append(text[i]) + + return ''.join(listy) + def tests(f): inputs = [['pokemon'], ['do not want'], ['POKEMON']] From 58cef935409c995110957b6e7e9ef2599c004ed8 Mon Sep 17 00:00:00 2001 From: Justyna Adamczyk Date: Thu, 31 May 2018 19:08:51 +0000 Subject: [PATCH 7/8] zrobione zad 11 --- labs02/task11.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/labs02/task11.py b/labs02/task11.py index 7d36767..63e6c4f 100644 --- a/labs02/task11.py +++ b/labs02/task11.py @@ -8,8 +8,14 @@ uporządkowaną listę wspólnych liter z lańcuchów string1 i string2. Oba napisy będą składać się wyłacznie z małych liter. """ + def common_chars(string1, string2): - pass + s=string1.replace(' ','') + t=string2.replace(' ','') + s=set(s) + t=set(t) + zwracam = sorted(s & t) + return list(''.join(zwracam)) def tests(f): From d612367edb59a310726420bf45bb49d241213734 Mon Sep 17 00:00:00 2001 From: Justyna Adamczyk Date: Sat, 2 Jun 2018 10:12:33 +0000 Subject: [PATCH 8/8] Zadanie 5 --- labs04/Zadanie 5 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 labs04/Zadanie 5 diff --git a/labs04/Zadanie 5 b/labs04/Zadanie 5 new file mode 100644 index 0000000..58257c6 --- /dev/null +++ b/labs04/Zadanie 5 @@ -0,0 +1,21 @@ +import glob + +sciezka = 'scores/*.npz.bleu' + +for plik in glob.glob(sciezka): + + with open(plik, 'r') as f: + + for linia in f.readlines(): + + numer = float(linia[linia.find("=") + 1:linia.find(",")]) + + if numer > 0: + + max_numer = numer + + max_numer_plik = plik + + f.close() + +print(max_numer_plik) \ No newline at end of file