From bd3f54bf53eadcc922343100b173b5fc087537a5 Mon Sep 17 00:00:00 2001 From: Alexsandr2008 <138139879+Alexsandr2008@users.noreply.github.com> Date: Wed, 18 Sep 2024 15:38:54 +0000 Subject: [PATCH 01/12] =?UTF-8?q?=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BB=20?= =?UTF-8?q?=D1=81=D0=B2=D0=BE=D1=8E=20=D0=BF=D0=B5=D1=80=D0=B2=D1=83=D1=8E?= =?UTF-8?q?=20=D0=BF=D1=80=D0=BE=D0=B3=D1=80=D0=B0=D0=BC=D0=BC=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hello.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 hello.py diff --git a/hello.py b/hello.py new file mode 100644 index 000000000..638eff256 --- /dev/null +++ b/hello.py @@ -0,0 +1 @@ +print("hello world!") \ No newline at end of file From ce795709f948a87010d91cf18768091672ede8ec Mon Sep 17 00:00:00 2001 From: Alexsandr2008 <138139879+Alexsandr2008@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:11:34 +0000 Subject: [PATCH 02/12] =?UTF-8?q?=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hello.py | 1 - 1 file changed, 1 deletion(-) delete mode 100644 hello.py diff --git a/hello.py b/hello.py deleted file mode 100644 index 638eff256..000000000 --- a/hello.py +++ /dev/null @@ -1 +0,0 @@ -print("hello world!") \ No newline at end of file From 7b50dfc5fe2026476052ab21f3b2604940fc4adf Mon Sep 17 00:00:00 2001 From: Alexsandr2008 <138139879+Alexsandr2008@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:57:04 +0000 Subject: [PATCH 03/12] =?UTF-8?q?2=20=D1=83=D1=80=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lec_bool.py | 15 +++++++++++++++ lec_if-elif-else.py | 7 +++++++ lec_if-else.py | 6 ++++++ lec_if.py | 12 ++++++++++++ lec_logic-oper.py | 10 ++++++++++ task(2)_1.py | 0 6 files changed, 50 insertions(+) create mode 100644 lec_bool.py create mode 100644 lec_if-elif-else.py create mode 100644 lec_if-else.py create mode 100644 lec_if.py create mode 100644 lec_logic-oper.py create mode 100644 task(2)_1.py diff --git a/lec_bool.py b/lec_bool.py new file mode 100644 index 000000000..590850ff6 --- /dev/null +++ b/lec_bool.py @@ -0,0 +1,15 @@ +print(bool(2)) + +print(bool("Good")) + +print(bool([1,4,5])) + +print(bool(0)) + +print(bool("")) + +print(bool([])) + +print(bool([[]])) + + diff --git a/lec_if-elif-else.py b/lec_if-elif-else.py new file mode 100644 index 000000000..6c71a9046 --- /dev/null +++ b/lec_if-elif-else.py @@ -0,0 +1,7 @@ +a = 3 +if a > 5: + print("hello 5") +elif a < 2: + print("hello 2") +else: + print("Tupo hello") \ No newline at end of file diff --git a/lec_if-else.py b/lec_if-else.py new file mode 100644 index 000000000..438e43f71 --- /dev/null +++ b/lec_if-else.py @@ -0,0 +1,6 @@ +a = 3 +if a== 4: + print(f"hello 4") +else: + print(f"hello{a}") + \ No newline at end of file diff --git a/lec_if.py b/lec_if.py new file mode 100644 index 000000000..ced96ea0e --- /dev/null +++ b/lec_if.py @@ -0,0 +1,12 @@ +if 1: + print("hello 1") + + a = 3 +if a > 1: + print(f" hello {a}") + + b = 5 +if b == 5: + print(f"hello {b}") + + diff --git a/lec_logic-oper.py b/lec_logic-oper.py new file mode 100644 index 000000000..5d79a8141 --- /dev/null +++ b/lec_logic-oper.py @@ -0,0 +1,10 @@ +a = 3 +b = 4 +if a > 4 and b == 2: # and - операция логического И + print ("Good") +elif b > 3 or c == 5: # or - операция логоческого или + print ("Best") +else : + print ("Bad") + + diff --git a/task(2)_1.py b/task(2)_1.py new file mode 100644 index 000000000..e69de29bb From 4419745d6fd52760c2af5a0efc3465535d1fe8c2 Mon Sep 17 00:00:00 2001 From: Alexsandr2008 <138139879+Alexsandr2008@users.noreply.github.com> Date: Wed, 2 Oct 2024 16:45:43 +0000 Subject: [PATCH 04/12] =?UTF-8?q?2=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- task(2)_1.py | 0 task2_3.py | 8 ++++++++ task2_5.py | 8 ++++++++ task__1.py | 5 +++++ 4 files changed, 21 insertions(+) delete mode 100644 task(2)_1.py create mode 100644 task2_3.py create mode 100644 task2_5.py create mode 100644 task__1.py diff --git a/task(2)_1.py b/task(2)_1.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/task2_3.py b/task2_3.py new file mode 100644 index 000000000..d205fd523 --- /dev/null +++ b/task2_3.py @@ -0,0 +1,8 @@ +a = int(input("Введите год: ")) +if a%4 == 0 and a%100 != 0 or a%4 == 0 and a%400 == 0 : + print("Этот год високосный") +elif a%100 == 0 and a%400 != 0 : + print("Этот год не високосный ") +else: + print("Этот год не високосный") + \ No newline at end of file diff --git a/task2_5.py b/task2_5.py new file mode 100644 index 000000000..e3f5ddc85 --- /dev/null +++ b/task2_5.py @@ -0,0 +1,8 @@ +a = int(input("Введите целое число: ")) +b = int(input("Введите целое число: ")) +if b == 0: + print ("На ноль делить нельзя") +elif a%b == 0: + print ("Число делится нацело") +elif a%b != 0: + print ("Число не делится нацело, остаток = ", a%b) diff --git a/task__1.py b/task__1.py new file mode 100644 index 000000000..e71fd65c2 --- /dev/null +++ b/task__1.py @@ -0,0 +1,5 @@ +a = int (input ("Введите число: ")) +if a%2 == 0: + print("Четное") +else: + print("Нечетное") \ No newline at end of file From a6ae6aca27add6c12a313b8e93d5d91488758171 Mon Sep 17 00:00:00 2001 From: Alexsandr2008 <138139879+Alexsandr2008@users.noreply.github.com> Date: Tue, 8 Oct 2024 18:30:03 +0000 Subject: [PATCH 05/12] =?UTF-8?q?2=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lec_task2_6.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lec_task2_6.py diff --git a/lec_task2_6.py b/lec_task2_6.py new file mode 100644 index 000000000..1d5848afe --- /dev/null +++ b/lec_task2_6.py @@ -0,0 +1,21 @@ +print("ax^2 + bx + c = 0") +a = int(input("Введите коэффициент a: ")) +b = int(input("Введите коэффициент b: ")) +c = int(input("Введите коэффициент с: ")) +print("Получилось крадратное уравнение:", a,"x^2 + ", b,"x + ",c,"= 0") +d = b**2 - 4*a*c +x1 = (-b - d * 0.5)/2*a +x2 = (-b + d * 0.5)/2*a +x3 = (-(b/2*a)) +print("Дискриминант данного уравнения равен:", d) +if d < 0: + print("Дискриминант меньше нуля,соответсвенно нет корней") +elif d == 0: + print("Дискриминант равен нулю, соответсвенно уравнение имеет 1 корень, x =",x3) +else: + print ("Дискриминант больше нуля, соответсвенно уравнение имеет 2 корня, x1 =",x1,",x2 =",x2) + + + + + From 63ff801b9448d2d8026c4d036bc3679fffcceb28 Mon Sep 17 00:00:00 2001 From: Alexsandr2008 <138139879+Alexsandr2008@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:08:46 +0000 Subject: [PATCH 06/12] =?UTF-8?q?2=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lec_task2_6.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lec_task2_6.py b/lec_task2_6.py index 1d5848afe..94a23c2ba 100644 --- a/lec_task2_6.py +++ b/lec_task2_6.py @@ -13,9 +13,4 @@ elif d == 0: print("Дискриминант равен нулю, соответсвенно уравнение имеет 1 корень, x =",x3) else: - print ("Дискриминант больше нуля, соответсвенно уравнение имеет 2 корня, x1 =",x1,",x2 =",x2) - - - - - + print ("Дискриминант больше нуля, соответсвенно уравнение имеет 2 корня, x1 =",x1,",x2 =",x2) \ No newline at end of file From a05a65f6ce789c8172bfb6b1beed0fc24479f146 Mon Sep 17 00:00:00 2001 From: Alexsandr2008 <138139879+Alexsandr2008@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:14:22 +0000 Subject: [PATCH 07/12] =?UTF-8?q?2=20=D1=83=D1=80=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lec_logic-oper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lec_logic-oper.py b/lec_logic-oper.py index 5d79a8141..efabce770 100644 --- a/lec_logic-oper.py +++ b/lec_logic-oper.py @@ -2,7 +2,7 @@ b = 4 if a > 4 and b == 2: # and - операция логического И print ("Good") -elif b > 3 or c == 5: # or - операция логоческого или +elif b > 3 or a == 5: # or - операция логоческого или print ("Best") else : print ("Bad") From 75d8511ba603fd5ce0778295f4700466ed8d2de4 Mon Sep 17 00:00:00 2001 From: Alexsandr2008 <138139879+Alexsandr2008@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:58:40 +0000 Subject: [PATCH 08/12] =?UTF-8?q?3=20=D1=83=D1=80=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lec_break-continue.py | 13 +++++++++++++ lec_for.py | 12 ++++++++++++ lec_range.py | 22 ++++++++++++++++++++++ lec_while.py | 16 ++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 lec_break-continue.py create mode 100644 lec_for.py create mode 100644 lec_range.py create mode 100644 lec_while.py diff --git a/lec_break-continue.py b/lec_break-continue.py new file mode 100644 index 000000000..c09194dca --- /dev/null +++ b/lec_break-continue.py @@ -0,0 +1,13 @@ +''' +if <условие прерывания>: + break / continue +''' + +for symbol in 'hello world': + if symbol == 'o': + break + print(symbol) + +for symbol in 'hello world': + if symbol == 'o': + continue \ No newline at end of file diff --git a/lec_for.py b/lec_for.py new file mode 100644 index 000000000..7a95e7aa5 --- /dev/null +++ b/lec_for.py @@ -0,0 +1,12 @@ +for i in 1, 3, 4: + print (i**2, end=" ") +for i in 1, 3, 4: + print (i**2, end="\n") +for i in 1, 3, 4: + print(i, i**2, sep=" - ") +a = [1, 5, 7, 10] +for i in a: + print(f"{i}**3 = {i**3}") + + + diff --git a/lec_range.py b/lec_range.py new file mode 100644 index 000000000..4a177b28f --- /dev/null +++ b/lec_range.py @@ -0,0 +1,22 @@ +''' +for <переменная цикла> in range(start, stop, step): + <интсрукция_1> + <интсрукция_2> + <интсрукция_3> # Тело оператора + .... + <интсрукция_n> + +По умолчанию: start = 0, step = 1 +Диапазон генерирования: [start, stop) +''' +a = range (0, 10, 2) +print(a) +print(type(a)) +print(a[3]) +a = "Good" +for i in range(0, 10, 1): + if i < len(a): + print(a[i] + " - Bad") + else: + print(f'{i}' + " - Good") + diff --git a/lec_while.py b/lec_while.py new file mode 100644 index 000000000..648079b17 --- /dev/null +++ b/lec_while.py @@ -0,0 +1,16 @@ +# Дудос +''' +while <переменная цикла> <условие>: + <интсрукция_1> + <интсрукция_2> + <интсрукция_3> + .... + <интсрукция_n> + + <переменная цикла> += step +''' +i = 5 +while i < 15: + print("i", i) + i += 2 + From 226eb0b06ce5a6288a1ca945902223bd775dc85a Mon Sep 17 00:00:00 2001 From: Alexsandr2008 <138139879+Alexsandr2008@users.noreply.github.com> Date: Wed, 9 Oct 2024 16:55:12 +0000 Subject: [PATCH 09/12] =?UTF-8?q?3=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lec_task2_6.py => dop_1.py | 4 ++-- dop_2.py | 13 +++++++++++++ task__1.py => task2_1.py | 0 task2_2.py | 6 ++++++ task2_4.py | 6 ++++++ task2_6.py | 4 ++++ 6 files changed, 31 insertions(+), 2 deletions(-) rename lec_task2_6.py => dop_1.py (93%) create mode 100644 dop_2.py rename task__1.py => task2_1.py (100%) create mode 100644 task2_2.py create mode 100644 task2_4.py create mode 100644 task2_6.py diff --git a/lec_task2_6.py b/dop_1.py similarity index 93% rename from lec_task2_6.py rename to dop_1.py index 94a23c2ba..666b3df4a 100644 --- a/lec_task2_6.py +++ b/dop_1.py @@ -4,8 +4,8 @@ c = int(input("Введите коэффициент с: ")) print("Получилось крадратное уравнение:", a,"x^2 + ", b,"x + ",c,"= 0") d = b**2 - 4*a*c -x1 = (-b - d * 0.5)/2*a -x2 = (-b + d * 0.5)/2*a +x1 = (-b - d ** 0.5)/(2*a) +x2 = (-b + d ** 0.5)/(2*a) x3 = (-(b/2*a)) print("Дискриминант данного уравнения равен:", d) if d < 0: diff --git a/dop_2.py b/dop_2.py new file mode 100644 index 000000000..8d502b7fa --- /dev/null +++ b/dop_2.py @@ -0,0 +1,13 @@ +a = int(input("Введите длину первой стороны: ")) +b = int(input("Введите длину второе стороны: ")) +z = int(input("Введите длину третьей стороны: ")) +if a + b > z and a + z > b and b + z > a: + print ("Такой треугольник существует") + if a == b == z: + print("Треугольник равностронний") + elif a == b or b == z or a == z: + print("Треугольник равнобедренный") + else: + print ("Треугольник равностронний") +else: + \ No newline at end of file diff --git a/task__1.py b/task2_1.py similarity index 100% rename from task__1.py rename to task2_1.py diff --git a/task2_2.py b/task2_2.py new file mode 100644 index 000000000..52c3f7360 --- /dev/null +++ b/task2_2.py @@ -0,0 +1,6 @@ +b1 = int (input ("Введите первой член геометрической прогрессия: ")) +q = int(input( "Введите знаменательный геометрической прогрессии: ")) +n = int(input("Введите количество n чисел геометрической прогрессии: ")) +for i in range(n): + z = b1 * (q**i) + print(f"Член прогрессии №{i + 1}: {z}") diff --git a/task2_4.py b/task2_4.py new file mode 100644 index 000000000..8be2435ec --- /dev/null +++ b/task2_4.py @@ -0,0 +1,6 @@ +n = int(input("Введите количество чисел в ряду Фибоначчи: ")) +a = b = 1 +print(a,b, end=" ") +for i in range(2,n): + a,b = b,a + b + print(b, end=" ") \ No newline at end of file diff --git a/task2_6.py b/task2_6.py new file mode 100644 index 000000000..e56b170f1 --- /dev/null +++ b/task2_6.py @@ -0,0 +1,4 @@ +for i in range(1, 10): + for z in range(1,10): + print("%4a"%(i * z), end="") + print() From 58abacb5e37f20f394f3b28e76e86788f922a4ef Mon Sep 17 00:00:00 2001 From: Alexsandr2008 <138139879+Alexsandr2008@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:40:49 +0000 Subject: [PATCH 10/12] =?UTF-8?q?4=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lec_3_import-as.py | 0 lec_3_my_import.py | 8 ++++++++ lec_3_my_module.py | 10 ++++++++++ 3 files changed, 18 insertions(+) create mode 100644 lec_3_import-as.py create mode 100644 lec_3_my_import.py create mode 100644 lec_3_my_module.py diff --git a/lec_3_import-as.py b/lec_3_import-as.py new file mode 100644 index 000000000..e69de29bb diff --git a/lec_3_my_import.py b/lec_3_my_import.py new file mode 100644 index 000000000..13185ae7a --- /dev/null +++ b/lec_3_my_import.py @@ -0,0 +1,8 @@ +# Модуль lec_3_import.py + +# Инструкция, целиком загружающая модуль +import lec_3_my_module +print(lec_3_my_module.a) +b = lec_3_my_module.b * 3 +print(b) +print(lec_3_my_module.c[2]) \ No newline at end of file diff --git a/lec_3_my_module.py b/lec_3_my_module.py new file mode 100644 index 000000000..457eb1215 --- /dev/null +++ b/lec_3_my_module.py @@ -0,0 +1,10 @@ +# Модуль lec_3_my_module.py + +# Атрибуты модуля +a = 3 +b = 'Good' +c = ['Bad', 4, 'Petya molodec'] + +earth_mass = 5.97237 * 10**30 +sigma_steff_bolc = 5.67036713 * 10**(-8) +gravity_constant = 6.67408 * 10**(-11) From e4f4c8dc10d4ffbdc4f223df5ba307997d70b055 Mon Sep 17 00:00:00 2001 From: Alexsandr2008 <138139879+Alexsandr2008@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:07:30 +0000 Subject: [PATCH 11/12] =?UTF-8?q?4=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __pycache__/lec_3_my_module.cpython-312.pyc | Bin 0 -> 320 bytes dop_2.py | 1 - lec_3_from.py | 9 +++++++++ lec_3_from_as.py | 9 +++++++++ lec_3_import-as.py | 9 +++++++++ lec_3_inorlibs_math.py | 9 +++++++++ lec_3_np_array.py | 12 ++++++++++++ lec_3_np_ndarray.py | 9 +++++++++ lec_3_numpy_generators | 8 ++++++++ lec_3_slice | 13 +++++++++++++ 10 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 __pycache__/lec_3_my_module.cpython-312.pyc create mode 100644 lec_3_from.py create mode 100644 lec_3_from_as.py create mode 100644 lec_3_inorlibs_math.py create mode 100644 lec_3_np_array.py create mode 100644 lec_3_np_ndarray.py create mode 100644 lec_3_numpy_generators create mode 100644 lec_3_slice diff --git a/__pycache__/lec_3_my_module.cpython-312.pyc b/__pycache__/lec_3_my_module.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..335895cbe53ade90455e51fbfc5c87e6a26b745c GIT binary patch literal 320 zcmX@j%ge<81d}fFr#}VKk3k$5V1hC}D*zeO8B!Rc7*ZIc7}FV2m=-ZcF{Lm^F{iLZ zv81p@u~xEavcF^oD!awvo}Zth$$X31DKX_G3s9trHz2j7GEpHnKPNvWH96f>+*rHt zMvz;&-tGH>-i3K~=}f=O`5i z#Q5Tp)U>qtr2L%ZTLS4tiDj83mGQ~>dBr7(c_k|uJ_GGy_@$*^o?nz*T#%TYTCAUx zSeyz}QCd`-s-KgZ9B&+-TN$65pHiBWs#j3?i^B%OwkzTXYGnlCVs#+#ftit!@dF0~ oD_aBO4Hm8j##=1%4U7+XWgEC|2y0wm5V#?%c9B7#h!?090E>}c_5c6? literal 0 HcmV?d00001 diff --git a/dop_2.py b/dop_2.py index 8d502b7fa..0b7e4e898 100644 --- a/dop_2.py +++ b/dop_2.py @@ -9,5 +9,4 @@ print("Треугольник равнобедренный") else: print ("Треугольник равностронний") -else: \ No newline at end of file diff --git a/lec_3_from.py b/lec_3_from.py new file mode 100644 index 000000000..2181a2eba --- /dev/null +++ b/lec_3_from.py @@ -0,0 +1,9 @@ +# Копирование указанных атрибутов модуля +from lec_3_my_module import a, b + +print(a * b) + +# Копирование ВСЕХ атрибутов модуля +from lec_3_my_module import * + +print(c[2] * c[1]) \ No newline at end of file diff --git a/lec_3_from_as.py b/lec_3_from_as.py new file mode 100644 index 000000000..32cd8262a --- /dev/null +++ b/lec_3_from_as.py @@ -0,0 +1,9 @@ +from lec_3_my_module import earth_mass as em +from lec_3_my_module import gravity_constant as G +from lec_3_my_module import sigma_steff_bolc as sigma + +g = 500 * G / 10**2 +print(g) + +x = em * G * sigma +print(x) \ No newline at end of file diff --git a/lec_3_import-as.py b/lec_3_import-as.py index e69de29bb..234a445c0 100644 --- a/lec_3_import-as.py +++ b/lec_3_import-as.py @@ -0,0 +1,9 @@ +# Создание псевдонима для имени модуля +import lec_3_my_module as mm + +print(mm.a) + +b = mm.b * 3 +print(b) + +print(mm.c[2] + b + mm.c[0]) \ No newline at end of file diff --git a/lec_3_inorlibs_math.py b/lec_3_inorlibs_math.py new file mode 100644 index 000000000..c9e4fb72f --- /dev/null +++ b/lec_3_inorlibs_math.py @@ -0,0 +1,9 @@ +import math +a = math.sin(3 * math.pi / 5) +print(a) +b = math.sqrt(3) +print(b) +c = math.log10(42) +print(c) +d = math.asin(math.tan(math.pi / 4)) * 180 / math.pi +print(d) \ No newline at end of file diff --git a/lec_3_np_array.py b/lec_3_np_array.py new file mode 100644 index 000000000..8c3c9b450 --- /dev/null +++ b/lec_3_np_array.py @@ -0,0 +1,12 @@ +# Массив это список с одиннаковым типом данных +import numpy as np +a = [1, 2, 4] +b = np.array(a) # Создание массива из списка +print(type(a)) +print(type(b)) +print(b * b) +print(b / b) +print(b - b) +c = np.append(b, "Good") +print(c) +print(b[-1]) \ No newline at end of file diff --git a/lec_3_np_ndarray.py b/lec_3_np_ndarray.py new file mode 100644 index 000000000..e65234073 --- /dev/null +++ b/lec_3_np_ndarray.py @@ -0,0 +1,9 @@ +import numpy as np +a = np.zeros((2, 3)) +print(a) +a[0,2] = 5 +print(a) +b = np.ones((3, 2)) +print(b) +d = np.ndarray((3, 3)) +print(d) \ No newline at end of file diff --git a/lec_3_numpy_generators b/lec_3_numpy_generators new file mode 100644 index 000000000..23ff495d5 --- /dev/null +++ b/lec_3_numpy_generators @@ -0,0 +1,8 @@ +import numpy as np +a = range(0,5,1) +print(a) +# a = range (0, 10, 0.1) +b = np.arange(0, 5, 0.1) +print(b) +d = np.linspace(0, 5, 10) +print(d) \ No newline at end of file diff --git a/lec_3_slice b/lec_3_slice new file mode 100644 index 000000000..cdc540bcf --- /dev/null +++ b/lec_3_slice @@ -0,0 +1,13 @@ +import numpy as np +a = [1, 5, 3, 6] +slice = a[0:2:1] +print(slice) +slice = a [3:0:-1] +print(slice) +slice = a[::-1] +print(slice) +b = np.array([a, np.array(a)*3]) +print(b) +slice = b[::, 1] +print(slice) + From 30fb23197e71f1d71b0eb11a91d5cf703d194d1f Mon Sep 17 00:00:00 2001 From: Alexsandr2008 <138139879+Alexsandr2008@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:56:26 +0000 Subject: [PATCH 12/12] =?UTF-8?q?4=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lec_3_task_2.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lec_3_task_2.py diff --git a/lec_3_task_2.py b/lec_3_task_2.py new file mode 100644 index 000000000..4b739601e --- /dev/null +++ b/lec_3_task_2.py @@ -0,0 +1,10 @@ +import math +g = 10 +h = 100 +a = 45 +b = 35 +v = math.sqrt(g*h * math.tan**2(b) / 2 * math.cos**2(a) * (1 - math.tan(b) * math.tan(a))) +print(v) +T = 200 +E = 300 +