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/README.md b/README.md index 714ee32..75c3995 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Вот сюда нужно будет в первой работе с гитом добавит свое ФИО -## ФИО +## Демьяненко Матвей Александрович ## Работа с репозиторием 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 e37a77c..0cf8354 100644 --- a/python/src/main.py +++ b/python/src/main.py @@ -1,7 +1,46 @@ -def summ(a: int, b: int) -> int: - return a + b +from codewar import * +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)}") + + +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))