From 179f07077cc55e52f810a73dc9eb190ed09b9952 Mon Sep 17 00:00:00 2001 From: Stepan Lebedev <115336305+SOX05@users.noreply.github.com> Date: Fri, 11 Nov 2022 19:50:13 +0300 Subject: [PATCH 1/4] =?UTF-8?q?Update=20and=20rename=20python/src/main.py?= =?UTF-8?q?=20to=20=D0=BF=D0=B8=D1=82=D0=BE=D0=BD/=D0=B8=D1=81=D1=82=D0=BE?= =?UTF-8?q?=D1=87=D0=BD=D0=B8=D0=BA/main.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/src/main.py | 7 ------ .../main.py" | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) delete mode 100644 python/src/main.py create mode 100644 "\320\277\320\270\321\202\320\276\320\275/\320\270\321\201\321\202\320\276\321\207\320\275\320\270\320\272/main.py" diff --git a/python/src/main.py b/python/src/main.py deleted file mode 100644 index e37a77c..0000000 --- a/python/src/main.py +++ /dev/null @@ -1,7 +0,0 @@ -def summ(a: int, b: int) -> int: - return a + b - - -if __name__ == "__main__": - print("Hello world") - print(summ(3, 4)) diff --git "a/\320\277\320\270\321\202\320\276\320\275/\320\270\321\201\321\202\320\276\321\207\320\275\320\270\320\272/main.py" "b/\320\277\320\270\321\202\320\276\320\275/\320\270\321\201\321\202\320\276\321\207\320\275\320\270\320\272/main.py" new file mode 100644 index 0000000..eac6a67 --- /dev/null +++ "b/\320\277\320\270\321\202\320\276\320\275/\320\270\321\201\321\202\320\276\321\207\320\275\320\270\320\272/main.py" @@ -0,0 +1,22 @@ +import math +def frange(start,stop,step): + + i=start + while i < stop: + yield i + i += step +def y(x): + y=(a**(x**2)-1)-math.log10((x**2)-1)+pow((x**2)-1,1/3) + return y +for x in frange (1.2,3.7,0.5): + a =1.6 + print(y(x)) + + + +xrange=[1.28,1.36,2.47,3.68,4.56] +xlen =len(xrange) +for i in range(0,xlen): + x=xrange[i] + a = 1.6 + print(y(x)) From c3aa00efec4480174dcfbfd049f97cf0d97ef798 Mon Sep 17 00:00:00 2001 From: Stepan Lebedev <115336305+SOX05@users.noreply.github.com> Date: Sat, 12 Nov 2022 11:02:16 +0300 Subject: [PATCH 2/4] commit --- python/src/main.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/python/src/main.py b/python/src/main.py index e37a77c..a112462 100644 --- a/python/src/main.py +++ b/python/src/main.py @@ -1,7 +1,22 @@ -def summ(a: int, b: int) -> int: - return a + b +import math +def frange(start,stop,step): + i=start + while i < stop: + yield i + i += step +def y(x): + y=(a**(x**2)-1)-math.log10((x**2)-1)+pow((x**2)-1,1/3) + return y +for x in frange (1.2,3.7,0.5): + a =1.6 + print(y(x)) -if __name__ == "__main__": - print("Hello world") - print(summ(3, 4)) + + +xrange=[1.28,1.36,2.47,3.68,4.56] +xlen =len(xrange) +for i in range(0,xlen): + x=xrange[i] + a = 1.6 + print(y(x)) \ No newline at end of file From 7258ced89f0136d8cbabafef70f1d7d02c7797f4 Mon Sep 17 00:00:00 2001 From: Stepan Lebedev <115336305+SOX05@users.noreply.github.com> Date: Sat, 12 Nov 2022 11:05:39 +0300 Subject: [PATCH 3/4] removed unused --- .../main.py" | 22 ------------------- 1 file changed, 22 deletions(-) delete mode 100644 "\320\277\320\270\321\202\320\276\320\275/\320\270\321\201\321\202\320\276\321\207\320\275\320\270\320\272/main.py" diff --git "a/\320\277\320\270\321\202\320\276\320\275/\320\270\321\201\321\202\320\276\321\207\320\275\320\270\320\272/main.py" "b/\320\277\320\270\321\202\320\276\320\275/\320\270\321\201\321\202\320\276\321\207\320\275\320\270\320\272/main.py" deleted file mode 100644 index eac6a67..0000000 --- "a/\320\277\320\270\321\202\320\276\320\275/\320\270\321\201\321\202\320\276\321\207\320\275\320\270\320\272/main.py" +++ /dev/null @@ -1,22 +0,0 @@ -import math -def frange(start,stop,step): - - i=start - while i < stop: - yield i - i += step -def y(x): - y=(a**(x**2)-1)-math.log10((x**2)-1)+pow((x**2)-1,1/3) - return y -for x in frange (1.2,3.7,0.5): - a =1.6 - print(y(x)) - - - -xrange=[1.28,1.36,2.47,3.68,4.56] -xlen =len(xrange) -for i in range(0,xlen): - x=xrange[i] - a = 1.6 - print(y(x)) From 9f1797227aff5ccf0785f51983e5d53d90037ea2 Mon Sep 17 00:00:00 2001 From: Stepan Lebedev <115336305+SOX05@users.noreply.github.com> Date: Tue, 6 Dec 2022 23:13:48 +0300 Subject: [PATCH 4/4] lab + codewar(1-8) --- python/src/codewars.py | 51 ++++++++++++++++++++++++++++++++++++++++++ python/src/main.py | 43 +++++++++++++++++++++++++---------- 2 files changed, 82 insertions(+), 12 deletions(-) create mode 100644 python/src/codewars.py diff --git a/python/src/codewars.py b/python/src/codewars.py new file mode 100644 index 0000000..ddb3225 --- /dev/null +++ b/python/src/codewars.py @@ -0,0 +1,51 @@ +# Evenor Odd +def even_or_odd(number): + if (number % 2) != 0: + return "Odd" + return "Even" + + +# Counting sheep... +def count_sheeps(sheep): + return sheep.count(True) + + +# Count the Monkeys! +def monkey_count(n): + result = [] + for num in range(1, n + 1): + result.append(num) + return result + + +# Beginner Series #1 School Paperwork +def paperwork(n, m): + if n < 0 or m < 0: + return 0 + else: + return n * m + + +# Is he gonna survive? +def hero(bullets, dragons): + return bullets >= (2 * dragons) + + +# Polish alphabet +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]) + + +# Sum of Minimums! +def sum_of_minimums(numbers): + return sum(map(min, numbers)) + + +# Find all occurrences of an element in an array +def find_all(array, n): + indices = [] + for i in range(len(array)): + if array[i] == n: + indices.append(i) + return indices diff --git a/python/src/main.py b/python/src/main.py index a112462..29e99a5 100644 --- a/python/src/main.py +++ b/python/src/main.py @@ -1,22 +1,41 @@ import math -def frange(start,stop,step): +from codewars import find_all, even_or_odd, correct_polish_letters, count_sheeps, monkey_count, hero, paperwork, sum_of_minimums +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)) - i=start + +def frange(start, stop, step): + + i = start while i < stop: - yield i + yield i i += step + + def y(x): - y=(a**(x**2)-1)-math.log10((x**2)-1)+pow((x**2)-1,1/3) + y = (a**(x**2) - 1) - math.log10((x**2) - 1) + pow((x ** 2) - 1, 1 / 3) return y -for x in frange (1.2,3.7,0.5): - a =1.6 - print(y(x)) +for x in frange(1.2, 3.7, 0.5): + a = 1.6 + print(y(x)) -xrange=[1.28,1.36,2.47,3.68,4.56] -xlen =len(xrange) -for i in range(0,xlen): - x=xrange[i] + +xrange = [1.28, 1.36, 2.47, 3.68, 4.56] +xlen = len(xrange) +for i in range(0, xlen): + x = xrange[i] a = 1.6 - print(y(x)) \ No newline at end of file + print(y(x))