From 336d3e3af5b116bcabced8a8d167548f1b5f9e45 Mon Sep 17 00:00:00 2001 From: Enc0re232 <118062627+Enc0re232@users.noreply.github.com> Date: Sat, 12 Nov 2022 18:07:17 +0300 Subject: [PATCH 1/3] lab 1 --- python/src/main.py | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/python/src/main.py b/python/src/main.py index e37a77c..7d3e6a6 100644 --- a/python/src/main.py +++ b/python/src/main.py @@ -1,7 +1,30 @@ -def summ(a: int, b: int) -> int: - return a + b +import math +a = 4.1 +b = 2.7 -if __name__ == "__main__": - print("Hello world") - print(summ(3, 4)) +def Y(x): + global a, b + + return (a * (x ** 1/3) - b * math.log(x, 5)) / (math.log(x - 1, 10) ** 3) + + +# task №23 A +print("task №23 A") + +x_first = 1.5 +x_last = 3.5 +step = 0.4 + +x = x_first +while x < x_last: + print(f"y({x}) = {Y(x)}") + x+=step + + +# task №23 B +print("task №23 B") + +array_x = [1.9, 2.15, 2.34, 2.74, 3.16] +for x in array_x: + print(f"y({x}) = {Y(x)}") From 735e003322fb7294f93d037db2be73ddf189dc15 Mon Sep 17 00:00:00 2001 From: Enc0re232 <118062627+Enc0re232@users.noreply.github.com> Date: Sat, 12 Nov 2022 18:11:47 +0300 Subject: [PATCH 2/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 714ee32..75c3995 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Вот сюда нужно будет в первой работе с гитом добавит свое ФИО -## ФИО +## Демьяненко Матвей Александрович ## Работа с репозиторием From 0ad986c948d0c641ee922fc8d0ef11cac083ca63 Mon Sep 17 00:00:00 2001 From: Demyanenko_Matvey Date: Wed, 7 Dec 2022 01:02:00 +0300 Subject: [PATCH 3/3] labcodewar(1-8) --- .idea/.gitignore | 3 + .idea/Informatics_2022.iml | 8 +++ .../inspectionProfiles/profiles_settings.xml | 6 ++ .idea/misc.xml | 4 ++ .idea/modules.xml | 8 +++ .idea/vcs.xml | 6 ++ python/src/codewar.py | 56 +++++++++++++++++++ python/src/main.py | 16 ++++++ 8 files changed, 107 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/Informatics_2022.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 python/src/codewar.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/Informatics_2022.iml b/.idea/Informatics_2022.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/Informatics_2022.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d56657a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..8a23b91 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/python/src/codewar.py b/python/src/codewar.py new file mode 100644 index 0000000..64d5478 --- /dev/null +++ b/python/src/codewar.py @@ -0,0 +1,56 @@ +import math + +#task1 +def even_or_odd(number): + if number % 2 == 0: + return "Even" + else: + return "Odd" +even_or_odd(10) + + +#task2 +def count_sheeps(sheep): + return sheep.count(True) + + +#task3 +def monkey_count(n): + result = [] + for num in range(1, n + 1): + result.append(num) + return result +monkey_count(10) + + +#task4 +def paperwork(n, m): + return n * m if n > 0 and m > 0 else 0 +paperwork(10,16) + + +#task5 +def hero(b, d): + bulletsneeded = d * 2 + if b >= bulletsneeded: + return True + else: + return False +hero(30,10) + +#task6 +def correct_polish_letters(st): + pol=pol = {"ą": "a", "ć": "c", "ę": "e", "ł": "l", "ń": "n", "ó": "o", "ś": "s", "ź": "z", "ż": "z"} + return "".join([pol[c] if c in pol else c for c in st]) + +#task7 +def find_all(array, n): + arr = [] + for el in range(len(array)-1): + if array[el] == n: + arr.append(el) + return arr + +#task8 +def sum_of_minimums(numbers): + return sum(map(min, numbers)) \ No newline at end of file diff --git a/python/src/main.py b/python/src/main.py index 7d3e6a6..0cf8354 100644 --- a/python/src/main.py +++ b/python/src/main.py @@ -1,3 +1,4 @@ +from codewar import * import math a = 4.1 @@ -28,3 +29,18 @@ def Y(x): array_x = [1.9, 2.15, 2.34, 2.74, 3.16] for x in array_x: print(f"y({x}) = {Y(x)}") + + +print(even_or_odd(2)) +print(count_sheeps([True, True, True, False, + True, True, True, True, + True, False, True, False, + True, False, False, True, + True, True, True, True, + False, False, True, True])) +print(monkey_count(5)) +print(paperwork(10, 10)) +print(hero(20, 5)) +print(correct_polish_letters("Jędrzej Błądziński")) +print(sum_of_minimums([[7, 9, 8, 6, 2], [6, 3, 5, 4, 3], [5, 8, 7, 4, 5]])) +print(find_all([6, 9, 3, 4, 3, 82, 11], 3))