исправление папки с заданиями
This commit is contained in:
parent
218dfa36e9
commit
4eef358a20
@ -1 +0,0 @@
|
|||||||
Subproject commit b714596fb59cffefb08edd018d16b3e51fdb2360
|
|
||||||
1
tasks_on_python/.idea/.name
generated
Normal file
1
tasks_on_python/.idea/.name
generated
Normal file
@ -0,0 +1 @@
|
|||||||
|
N23_most_freq.py
|
||||||
7
tasks_on_python/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
7
tasks_on_python/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="PyInterpreterInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="ReassignedToPlainText" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
6
tasks_on_python/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
tasks_on_python/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
4
tasks_on_python/.idea/misc.xml
generated
Normal file
4
tasks_on_python/.idea/misc.xml
generated
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
||||||
8
tasks_on_python/.idea/modules.xml
generated
Normal file
8
tasks_on_python/.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/tasks_on_python.iml" filepath="$PROJECT_DIR$/.idea/tasks_on_python.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
8
tasks_on_python/.idea/tasks_on_python.iml
generated
Normal file
8
tasks_on_python/.idea/tasks_on_python.iml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
6
tasks_on_python/.idea/vcs.xml
generated
Normal file
6
tasks_on_python/.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
101
tasks_on_python/.idea/workspace.xml
generated
Normal file
101
tasks_on_python/.idea/workspace.xml
generated
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AutoImportSettings">
|
||||||
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
|
</component>
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" id="4ec032e6-bd75-4c5d-8094-08c969f7028e" name="Changes" comment="" />
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="FileTemplateManagerImpl">
|
||||||
|
<option name="RECENT_TEMPLATES">
|
||||||
|
<list>
|
||||||
|
<option value="Python Script" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="Git.Settings">
|
||||||
|
<excluded-from-favorite>
|
||||||
|
<branch-storage>
|
||||||
|
<map>
|
||||||
|
<entry type="LOCAL">
|
||||||
|
<value>
|
||||||
|
<list>
|
||||||
|
<branch-info repo="$PROJECT_DIR$" source="master" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</branch-storage>
|
||||||
|
</excluded-from-favorite>
|
||||||
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectColorInfo">{
|
||||||
|
"associatedIndex": 6
|
||||||
|
}</component>
|
||||||
|
<component name="ProjectId" id="3CD8EP2HU6Zj1nTKYyUGcizziYA" />
|
||||||
|
<component name="ProjectViewState">
|
||||||
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
|
<option name="showLibraryContents" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
|
"keyToString": {
|
||||||
|
"Python.N18_intersection_massive.executor": "Run",
|
||||||
|
"Python.N21_long_subseq.executor": "Run",
|
||||||
|
"Python.N23_most_freq.executor": "Run",
|
||||||
|
"Python.N2_dublic_chars.executor": "Run",
|
||||||
|
"Python.intersection_massive.executor": "Run",
|
||||||
|
"Python.main.executor": "Run",
|
||||||
|
"Python.meeeeein.executor": "Run",
|
||||||
|
"Python.num_arm.executor": "Run",
|
||||||
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
|
"git-widget-placeholder": "master",
|
||||||
|
"last_opened_file_path": "C:/Users/Максим/Desktop/доки по вузу/2_курс/практика_2/E_Commerce_Review_Engine",
|
||||||
|
"settings.editor.selected.configurable": "preferences.lookFeel"
|
||||||
|
}
|
||||||
|
}]]></component>
|
||||||
|
<component name="SharedIndexes">
|
||||||
|
<attachedChunks>
|
||||||
|
<set>
|
||||||
|
<option value="bundled-python-sdk-babbdf50b680-746f403e7f0c-com.jetbrains.pycharm.community.sharedIndexes.bundled-PC-241.15989.155" />
|
||||||
|
</set>
|
||||||
|
</attachedChunks>
|
||||||
|
</component>
|
||||||
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
|
<component name="TaskManager">
|
||||||
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
<changelist id="4ec032e6-bd75-4c5d-8094-08c969f7028e" name="Changes" comment="" />
|
||||||
|
<created>1775908667212</created>
|
||||||
|
<option name="number" value="Default" />
|
||||||
|
<option name="presentableId" value="Default" />
|
||||||
|
<updated>1775908667212</updated>
|
||||||
|
</task>
|
||||||
|
<servers />
|
||||||
|
</component>
|
||||||
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
<option name="TAB_STATES">
|
||||||
|
<map>
|
||||||
|
<entry key="MAIN">
|
||||||
|
<value>
|
||||||
|
<State>
|
||||||
|
<option name="FILTERS">
|
||||||
|
<map>
|
||||||
|
<entry key="branch">
|
||||||
|
<value>
|
||||||
|
<list>
|
||||||
|
<option value="master" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</State>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
19
tasks_on_python/N12_num_arm.py
Normal file
19
tasks_on_python/N12_num_arm.py
Normal file
@ -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("Число не является числом Армстронга")
|
||||||
16
tasks_on_python/N18_intersection_massive.py
Normal file
16
tasks_on_python/N18_intersection_massive.py
Normal file
@ -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))
|
||||||
20
tasks_on_python/N21_long_subseq.py
Normal file
20
tasks_on_python/N21_long_subseq.py
Normal file
@ -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())
|
||||||
18
tasks_on_python/N23_most_freq.py
Normal file
18
tasks_on_python/N23_most_freq.py
Normal file
@ -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
|
||||||
18
tasks_on_python/N2_dublic_chars.py
Normal file
18
tasks_on_python/N2_dublic_chars.py
Normal file
@ -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())
|
||||||
Loading…
Reference in New Issue
Block a user