From b430a84a7146e7e418a6b33539e0dc6ba805feb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D0=BA=D1=81=D0=B0=D0=BD=D0=B0=20=D0=9C=D1=83=D0=B7?= =?UTF-8?q?=D0=B8=D0=BA=D0=B0?= <32312185+oksanamuzyka@users.noreply.github.com> Date: Thu, 23 Nov 2017 21:16:22 +0200 Subject: [PATCH 1/2] Create 6 --- 6/6 | 1 + 1 file changed, 1 insertion(+) create mode 100644 6/6 diff --git a/6/6 b/6/6 new file mode 100644 index 00000000..1e8b3149 --- /dev/null +++ b/6/6 @@ -0,0 +1 @@ +6 From e83f01ba3bc031c85bcefdd0675044467910eaa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D0=BA=D1=81=D0=B0=D0=BD=D0=B0=20=D0=9C=D1=83=D0=B7?= =?UTF-8?q?=D0=B8=D0=BA=D0=B0?= <32312185+oksanamuzyka@users.noreply.github.com> Date: Thu, 23 Nov 2017 21:17:19 +0200 Subject: [PATCH 2/2] Add files via upload --- 6/task1.py | 8 ++++++++ 6/task2.py | 12 ++++++++++++ 6/task3.py | 8 ++++++++ 3 files changed, 28 insertions(+) create mode 100644 6/task1.py create mode 100644 6/task2.py create mode 100644 6/task3.py diff --git a/6/task1.py b/6/task1.py new file mode 100644 index 00000000..819ab32d --- /dev/null +++ b/6/task1.py @@ -0,0 +1,8 @@ +def distance(x1, y1, x2, y2): + res = ((x1-x2)**2 + (y1-y2)**2)**0.5 + return res +x1 = float(input('Enter x1: ')) +y1 = float(input('Enter y1: ')) +x2 = float(input('Enter x2: ')) +y2 = float(input('Enter y2: ')) +print(distance(x1, y1, x2, y2)) diff --git a/6/task2.py b/6/task2.py new file mode 100644 index 00000000..369c7e92 --- /dev/null +++ b/6/task2.py @@ -0,0 +1,12 @@ +a = float(input('Enter number: ')) +n = int(input('Enter degree of number: ')) +def power(a,n): + if n < 0: + a = 1.0/a + n = -n + res = 1 + while n > 0: + res = res * a + n = n-1 + return res +print(power(a,n)) diff --git a/6/task3.py b/6/task3.py new file mode 100644 index 00000000..b1483bb6 --- /dev/null +++ b/6/task3.py @@ -0,0 +1,8 @@ +a = float(input('Enter number: ')) +n = int(input('Enter degree of number: ')) +def power(a, n): + if n == 0: + return 1 + else: + return a * power(a, n - 1) +print(power(a, n))