From 4eef358a20f857ccf0a80f85ff228e48da4f2761 Mon Sep 17 00:00:00 2001 From: stud203799 Date: Tue, 14 Apr 2026 18:21:17 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=B0=D0=BF=D0=BA=D0=B8=20?= =?UTF-8?q?=D1=81=20=D0=B7=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tasks_on_python | 1 - tasks_on_python/.idea/.name | 1 + .../inspectionProfiles/Project_Default.xml | 7 ++ .../inspectionProfiles/profiles_settings.xml | 6 ++ tasks_on_python/.idea/misc.xml | 4 + tasks_on_python/.idea/modules.xml | 8 ++ tasks_on_python/.idea/tasks_on_python.iml | 8 ++ tasks_on_python/.idea/vcs.xml | 6 ++ tasks_on_python/.idea/workspace.xml | 101 ++++++++++++++++++ tasks_on_python/N12_num_arm.py | 19 ++++ tasks_on_python/N18_intersection_massive.py | 16 +++ tasks_on_python/N21_long_subseq.py | 20 ++++ tasks_on_python/N23_most_freq.py | 18 ++++ tasks_on_python/N2_dublic_chars.py | 18 ++++ 14 files changed, 232 insertions(+), 1 deletion(-) delete mode 160000 tasks_on_python create mode 100644 tasks_on_python/.idea/.name create mode 100644 tasks_on_python/.idea/inspectionProfiles/Project_Default.xml create mode 100644 tasks_on_python/.idea/inspectionProfiles/profiles_settings.xml create mode 100644 tasks_on_python/.idea/misc.xml create mode 100644 tasks_on_python/.idea/modules.xml create mode 100644 tasks_on_python/.idea/tasks_on_python.iml create mode 100644 tasks_on_python/.idea/vcs.xml create mode 100644 tasks_on_python/.idea/workspace.xml create mode 100644 tasks_on_python/N12_num_arm.py create mode 100644 tasks_on_python/N18_intersection_massive.py create mode 100644 tasks_on_python/N21_long_subseq.py create mode 100644 tasks_on_python/N23_most_freq.py create mode 100644 tasks_on_python/N2_dublic_chars.py diff --git a/tasks_on_python b/tasks_on_python deleted file mode 160000 index b714596..0000000 --- a/tasks_on_python +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b714596fb59cffefb08edd018d16b3e51fdb2360 diff --git a/tasks_on_python/.idea/.name b/tasks_on_python/.idea/.name new file mode 100644 index 0000000..dea7738 --- /dev/null +++ b/tasks_on_python/.idea/.name @@ -0,0 +1 @@ +N23_most_freq.py \ No newline at end of file diff --git a/tasks_on_python/.idea/inspectionProfiles/Project_Default.xml b/tasks_on_python/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..46b0337 --- /dev/null +++ b/tasks_on_python/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/tasks_on_python/.idea/inspectionProfiles/profiles_settings.xml b/tasks_on_python/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/tasks_on_python/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/tasks_on_python/.idea/misc.xml b/tasks_on_python/.idea/misc.xml new file mode 100644 index 0000000..060d2c5 --- /dev/null +++ b/tasks_on_python/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/tasks_on_python/.idea/modules.xml b/tasks_on_python/.idea/modules.xml new file mode 100644 index 0000000..ecc1d0e --- /dev/null +++ b/tasks_on_python/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/tasks_on_python/.idea/tasks_on_python.iml b/tasks_on_python/.idea/tasks_on_python.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/tasks_on_python/.idea/tasks_on_python.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/tasks_on_python/.idea/vcs.xml b/tasks_on_python/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/tasks_on_python/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tasks_on_python/.idea/workspace.xml b/tasks_on_python/.idea/workspace.xml new file mode 100644 index 0000000..41d61ef --- /dev/null +++ b/tasks_on_python/.idea/workspace.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + { + "associatedIndex": 6 +} + + + + + + + + + + + + + + + 1775908667212 + + + + + + + \ No newline at end of file diff --git a/tasks_on_python/N12_num_arm.py b/tasks_on_python/N12_num_arm.py new file mode 100644 index 0000000..e2f7c15 --- /dev/null +++ b/tasks_on_python/N12_num_arm.py @@ -0,0 +1,19 @@ +# №12. is_armstrong(n: int) -> bool +# Проверить, является ли число числом Армстронга (сумма цифр, возведённых в степень количества цифр, равна числу). Пример: 153 = 1³ + 5³ + 3³. + +def num_armstrong(n: int): + s = str(n) + sum_cubed = [] + for i in s: + sum_cubed.append(int(i)**len(s)) + if n == sum(sum_cubed): + return True + else: + return False + + +print("Введите число для проверки на число Армстронга") +if num_armstrong(int(input())): + print("Число является числом Армстронга") +else: + print("Число не является числом Армстронга") \ No newline at end of file diff --git a/tasks_on_python/N18_intersection_massive.py b/tasks_on_python/N18_intersection_massive.py new file mode 100644 index 0000000..a9ee1e8 --- /dev/null +++ b/tasks_on_python/N18_intersection_massive.py @@ -0,0 +1,16 @@ +# №18. intersection_of_sorted(a: list, b: list) -> list +# Найти пересечение двух отсортированных списков (без дубликатов). Сложность O(n+m). + +def intersec_mass(a: list, b: list): + im = [] + for i in a: + for j in b: + if i == j: + im.append(i) + return im + + +print("Введите два массива для поиска пересечения") +a = input().split() +b = input().split() +print(intersec_mass(a, b)) diff --git a/tasks_on_python/N21_long_subseq.py b/tasks_on_python/N21_long_subseq.py new file mode 100644 index 0000000..fb53f93 --- /dev/null +++ b/tasks_on_python/N21_long_subseq.py @@ -0,0 +1,20 @@ +# №21. longest_increasing_subsequence(arr: list) -> list +# Найти самую длинную возрастающую подпоследовательность (не обязательно непрерывную). + +# def long_inc_subseq(a: list): +a = [10, 9, 2, 5, 3, 7, 101, 18] +av = [] +for i in range(len(a)): + if i == len(a)-1: # цикл на последней итерации + if a[i] > av[-1]: + av.append(a[i]) + break + else: + break + if a[i] > a[i+1]: + av.append(a[i]) +print(av) + + +print("Введите последовательность чисел через пробел") +# long_inc_subseq(input().split()) \ No newline at end of file diff --git a/tasks_on_python/N23_most_freq.py b/tasks_on_python/N23_most_freq.py new file mode 100644 index 0000000..705babc --- /dev/null +++ b/tasks_on_python/N23_most_freq.py @@ -0,0 +1,18 @@ +# №23. most_frequent_value(d: dict) -> tuple +# Найти значение, которое чаще всего встречается среди значений словаря. Вернуть (значение, частота). + +alph = { + "a": 1, + "b": 2, + "c": 1, + "d": 1, + "e": 2, +} +c = 0 +a = list(alph.values()) +b = () +for i in range(len(alph)): + + for j in range(len(alph)): + if a[i] == a[j]: + c += 1 diff --git a/tasks_on_python/N2_dublic_chars.py b/tasks_on_python/N2_dublic_chars.py new file mode 100644 index 0000000..32d0e94 --- /dev/null +++ b/tasks_on_python/N2_dublic_chars.py @@ -0,0 +1,18 @@ +# №2. remove_duplicate_chars(s: str) -> str +# Удалить из строки все повторяющиеся символы, оставив только первое вхождение каждого. + +def dupl_chars(a: str): + b = "" + b += a[0] + for i in range(len(a)): + if len(a) > 1: + for j in range(len(a)): + if a[i] != a[j] and a[j] not in b: + b += a[j] + else: + break + print(b) + + +print("Введите набор символов для поиска первого вхождения") +dupl_chars(input()) \ No newline at end of file