Compare commits
62
Commits
f9a2ce3c0e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98c27fec85 | ||
|
|
b9fa6eee41 | ||
|
|
7c7563c10e | ||
|
|
88717a0a98 | ||
|
|
50d5510e04 | ||
|
|
b28f0ea2de | ||
|
|
26cb488778 | ||
|
|
f1f9f4700c | ||
|
|
2423f84e3b | ||
|
|
251e8414a7 | ||
|
|
4af8081cc2 | ||
|
|
80aae37864 | ||
|
|
4ba3945bd9 | ||
|
|
7369143b6d | ||
|
|
4660f05101 | ||
|
|
158ae6448c | ||
|
|
b08e67b7b3 | ||
|
|
4a9dca4b14 | ||
|
|
705a2f51fc | ||
|
|
b9722e67c6 | ||
|
|
b86ba1c692 | ||
|
|
66f9b735ec | ||
|
|
5084c29415 | ||
|
|
aa65bc8915 | ||
|
|
df802eaf13 | ||
|
|
a6da45b35f | ||
|
|
44a5892882 | ||
|
|
365b887b3a | ||
|
|
d0f66ac101 | ||
|
|
099360989f | ||
|
|
4159d0e611 | ||
|
|
4da0248528 | ||
|
|
9d4dbb2643 | ||
|
|
ae043285b9 | ||
|
|
ad839dd8ad | ||
|
|
f33ff57a03 | ||
|
|
0aba06e1d2 | ||
|
|
a93843aab9 | ||
|
|
80ab2f7a71 | ||
|
|
63397cd1ec | ||
|
|
a646f557a8 | ||
|
|
9677609ef3 | ||
|
|
6573b20105 | ||
|
|
23f45b2831 | ||
|
|
f21f0ec066 | ||
|
|
9521a36aa8 | ||
|
|
0b559de827 | ||
|
|
a1a6e8414c | ||
|
|
5e975f3c29 | ||
|
|
5d011f59a5 | ||
|
|
98f6e60e47 | ||
|
|
5c5caf37f1 | ||
|
|
7ca6593e87 | ||
|
|
e14554f8e1 | ||
|
|
355993be24 | ||
|
|
7295815fc6 | ||
|
|
557b38ac30 | ||
|
|
cfb13cb29e | ||
|
|
529c997c32 | ||
|
|
ee1566f82e | ||
|
|
63ff90fd7b | ||
|
|
f00bfe4a5b |
@@ -0,0 +1,3 @@
|
||||
Работы/МИАД/.$hierc_simple.drawio.bkp
|
||||
|
||||
Работы/ИРФМ/data/montcoalert/911.csv
|
||||
@@ -0,0 +1 @@
|
||||
3.13
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
|
||||
# %%
|
||||
|
||||
# %%
|
||||
|
||||
|
||||
# %%
|
||||
|
||||
# %%
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
@@ -0,0 +1,10 @@
|
||||
[project]
|
||||
name = "lab3"
|
||||
version = "0.1.0"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.13"
|
||||
dependencies = [
|
||||
"jupyterlab>=4.5.6",
|
||||
"matplotlib>=3.10.8",
|
||||
]
|
||||
Generated
+1742
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
def main():
|
||||
print("Hello from rias-mephi!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
[project]
|
||||
name = "rias-mephi"
|
||||
version = "0.1.0"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
dependencies = [
|
||||
"jupyterlab>=4.5.6",
|
||||
"matplotlib>=3.10.9",
|
||||
"mplfinance>=0.12.10b0",
|
||||
"pandas>=3.0.2",
|
||||
]
|
||||
Generated
+1955
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 MiB After Width: | Height: | Size: 3.3 MiB |
|
Before Width: | Height: | Size: 3.1 MiB After Width: | Height: | Size: 3.1 MiB |
@@ -0,0 +1 @@
|
||||
3.12
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
"""Django's command-line utility for administrative tasks."""
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
"""Run administrative tasks."""
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mephi_app.settings')
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
) from exc
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
ASGI config for mephi_app project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/6.0/howto/deployment/asgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mephi_app.settings')
|
||||
|
||||
application = get_asgi_application()
|
||||
@@ -0,0 +1,107 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-#pk6j+5iy8gxi!4o2ll&aci==cbj4e)kxx7f%7u8!#s^o2qb61'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'polls.apps.PollsConfig',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'mephi_app.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'mephi_app.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/6.0/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': BASE_DIR / 'db.sqlite3',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/6.0/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/6.0/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'ru-ru'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/6.0/howto/static-files/
|
||||
|
||||
STATIC_URL = 'static/'
|
||||
@@ -0,0 +1,22 @@
|
||||
"""
|
||||
URL configuration for mephi_app project.
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/6.0/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
]
|
||||
@@ -0,0 +1,7 @@
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mephi_app.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
@@ -0,0 +1,20 @@
|
||||
from django.contrib import admin
|
||||
|
||||
class ChoiceInline(admin.TabularInline):
|
||||
model = Choice
|
||||
extra = 2
|
||||
|
||||
admin.site.register(Choice)
|
||||
# Register your models here.
|
||||
class QuestionAdmin(admin.ModelAdmin):
|
||||
list_display = ('question_text', 'pub_date')
|
||||
list_display_links = ('question_text', 'pub_date')
|
||||
search_fields = ('question_text',)
|
||||
|
||||
admin.site.register(Question, QuestionAdmin)
|
||||
|
||||
class ChoiceAdmin(admin.ModelAdmin):
|
||||
list_display = ('choice_text', 'question', 'votes')
|
||||
list_display_links = ('choice_text', 'question')
|
||||
search_fields = ('choice_text',)
|
||||
admin.site.register(Choice, ChoiceAdmin)
|
||||
@@ -0,0 +1,5 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class PollsConfig(AppConfig):
|
||||
name = 'polls'
|
||||
@@ -0,0 +1,22 @@
|
||||
# Generated by Django 6.0.4 on 2026-04-08 10:39
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Question',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('question_text', models.CharField(max_length=200, verbose_name='Вопрос')),
|
||||
('pub_date', models.DateTimeField(verbose_name='Дата публикации')),
|
||||
],
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 6.0.4 on 2026-04-08 10:43
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('polls', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Choice',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('choice_text', models.CharField(max_length=200, verbose_name='Ответ')),
|
||||
('votes', models.IntegerField(default=0, verbose_name='Количество голосов')),
|
||||
('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='polls.question')),
|
||||
],
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,12 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
class Question(models.Model):
|
||||
question_text = models.CharField(verbose_name='Вопрос', max_length=200)
|
||||
pub_date = models.DateTimeField(verbose_name='Дата публикации')
|
||||
|
||||
class Choice(models.Model):
|
||||
question = models.ForeignKey(Question, on_delete=models.CASCADE)
|
||||
choice_text = models.CharField(verbose_name='Ответ', max_length=200)
|
||||
votes = models.IntegerField(verbose_name='Количество голосов', default=0)
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@@ -0,0 +1,8 @@
|
||||
from djano.urls import path
|
||||
|
||||
urlpatterns = [
|
||||
# path('', views.index, name='index'),
|
||||
# path('<int:question_id>/', views.detail, name='detail'),
|
||||
# path('<int:question_id>/results/', views.results, name='results'),
|
||||
# path('<int:question_id>/vote/', views.vote, name='vote'),
|
||||
]
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
@@ -0,0 +1,9 @@
|
||||
[project]
|
||||
name = "web-django"
|
||||
version = "0.1.0"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
dependencies = [
|
||||
"django>=6.0.4",
|
||||
]
|
||||
Generated
+55
@@ -0,0 +1,55 @@
|
||||
version = 1
|
||||
revision = 3
|
||||
requires-python = ">=3.12"
|
||||
|
||||
[[package]]
|
||||
name = "asgiref"
|
||||
version = "3.11.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/63/40/f03da1264ae8f7cfdbf9146542e5e7e8100a4c66ab48e791df9a03d3f6c0/asgiref-3.11.1.tar.gz", hash = "sha256:5f184dc43b7e763efe848065441eac62229c9f7b0475f41f80e207a114eda4ce", size = 38550, upload-time = "2026-02-03T13:30:14.33Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/5c/0a/a72d10ed65068e115044937873362e6e32fab1b7dce0046aeb224682c989/asgiref-3.11.1-py3-none-any.whl", hash = "sha256:e8667a091e69529631969fd45dc268fa79b99c92c5fcdda727757e52146ec133", size = 24345, upload-time = "2026-02-03T13:30:13.039Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "django"
|
||||
version = "6.0.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "asgiref" },
|
||||
{ name = "sqlparse" },
|
||||
{ name = "tzdata", marker = "sys_platform == 'win32'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/60/b9/4155091ad1788b38563bd77a7258c0834e8c12a7f56f6975deaf54f8b61d/django-6.0.4.tar.gz", hash = "sha256:8cfa2572b3f2768b2e84983cf3c4811877a01edb64e817986ec5d60751c113ac", size = 10907407, upload-time = "2026-04-07T13:55:44.961Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e9/47/3d61d611609764aa71a37f7037b870e7bfb22937366974c4fd46cada7bab/django-6.0.4-py3-none-any.whl", hash = "sha256:14359c809fc16e8f81fd2b59d7d348e4d2d799da6840b10522b6edf7b8afc1da", size = 8368342, upload-time = "2026-04-07T13:55:37.999Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlparse"
|
||||
version = "0.5.5"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/90/76/437d71068094df0726366574cf3432a4ed754217b436eb7429415cf2d480/sqlparse-0.5.5.tar.gz", hash = "sha256:e20d4a9b0b8585fdf63b10d30066c7c94c5d7a7ec47c889a2d83a3caa93ff28e", size = 120815, upload-time = "2025-12-19T07:17:45.073Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/49/4b/359f28a903c13438ef59ebeee215fb25da53066db67b305c125f1c6d2a25/sqlparse-0.5.5-py3-none-any.whl", hash = "sha256:12a08b3bf3eec877c519589833aed092e2444e68240a3577e8e26148acc7b1ba", size = 46138, upload-time = "2025-12-19T07:17:46.573Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tzdata"
|
||||
version = "2026.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/19/f5/cd531b2d15a671a40c0f66cf06bc3570a12cd56eef98960068ebbad1bf5a/tzdata-2026.1.tar.gz", hash = "sha256:67658a1903c75917309e753fdc349ac0efd8c27db7a0cb406a25be4840f87f98", size = 197639, upload-time = "2026-04-03T11:25:22.002Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/b0/70/d460bd685a170790ec89317e9bd33047988e4bce507b831f5db771e142de/tzdata-2026.1-py2.py3-none-any.whl", hash = "sha256:4b1d2be7ac37ceafd7327b961aa3a54e467efbdb563a23655fbfe0d39cfc42a9", size = 348952, upload-time = "2026-04-03T11:25:20.313Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-django"
|
||||
version = "0.1.0"
|
||||
source = { virtual = "." }
|
||||
dependencies = [
|
||||
{ name = "django" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [{ name = "django", specifier = ">=6.0.4" }]
|
||||
@@ -0,0 +1,277 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "5ffc18fc",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Генераторы массивов"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "17f0549b",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n",
|
||||
"{0, 1, 2}\n",
|
||||
"(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"\n",
|
||||
"n = 20\n",
|
||||
"a = [i for i in range(n)]\n",
|
||||
"b = {i%3 for i in range(n)}\n",
|
||||
"c = tuple(i for i in range(n))\n",
|
||||
"print(a)\n",
|
||||
"print(b)\n",
|
||||
"print(c)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "f64d6b65",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[62, 64, 58, 6, 28, 8, 3, 4, 8, 2, 94, 65, 4, 23, 26, 38, 67, 4, 72, 82]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Модуль random\n",
|
||||
"import random as rd\n",
|
||||
"a = [rd.randint(0, 100) for i in range(n)]\n",
|
||||
"print(a)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "a03afa9b",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64, 9: 81, 10: 100, 11: 121, 12: 144, 13: 169, 14: 196, 15: 225, 16: 256, 17: 289, 18: 324, 19: 361}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Генерация словаря\n",
|
||||
"d = {i: i**2 for i in range(n)}\n",
|
||||
"print(d)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "1523bfb5",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Сортировка"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "0e5b7a6e",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[-98, -96, -92, -60, -49, -42, -32, -18, -10, -10, 42, 53, 55, 64, 73, 75, 78, 81, 81, 98]\n",
|
||||
"[98, 81, 81, 78, 75, 73, 64, 55, 53, 42, -10, -10, -18, -32, -42, -49, -60, -92, -96, -98]\n",
|
||||
"[-10, -10, -18, -32, 42, -42, -49, 53, 55, -60, 64, 73, 75, 78, 81, 81, -92, -96, -98, 98]\n",
|
||||
"[-98, -96, -92, -60, -49, -42, -32, -18, -10, -10, 42, 53, 55, 64, 73, 75, 78, 81, 81, 98]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# sort и sorted\n",
|
||||
"\n",
|
||||
"a = [rd.randint(-100, 100) for i in range(n)]\n",
|
||||
"\n",
|
||||
"b = sorted(a) # Возвращает новый отсортированный список\n",
|
||||
"print(b)\n",
|
||||
"\n",
|
||||
"c = sorted(a, reverse=True) # Сортирует в обратном порядке\n",
|
||||
"print(c)\n",
|
||||
"\n",
|
||||
"e = sorted(a, key=lambda x: abs(x)) # Сортирует по ключу, в данном случае по абсолютному значению\n",
|
||||
"print(e)\n",
|
||||
"\n",
|
||||
"a.sort() # Сортирует список на месте, ничего не возвращает\n",
|
||||
"print(a)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "9b186915",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[-98, -96, -92, -60, -42, -32, -18, -10, -10, 42, 64, 78, 98]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# метод filter\n",
|
||||
"\n",
|
||||
"f = filter(lambda x: x % 2 == 0, a) # Фильтрует элементы, оставляя только четные\n",
|
||||
"print(list(f))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "8966f584",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Операции со строками"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"id": "886e6200",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"['fefef', '', '', '', '', 'egege', 'wpdwpfwof', '', '', '', 'eijoifwmfkwmfl', '', '', '', 'dwpdwpekwp']\n",
|
||||
"['fefef', 'egege', 'wpdwpfwof', 'eijoifwmfkwmfl', 'dwpdwpekwp']\n",
|
||||
"['Fefef', 'Egege', 'Wpdwpfwof', 'Eijoifwmfkwmfl', 'Dwpdwpekwp']\n",
|
||||
"Fefef Egege Wpdwpfwof Eijoifwmfkwmfl Dwpdwpekwp\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"s = \"fefef egege wpdwpfwof eijoifwmfkwmfl dwpdwpekwp\"\n",
|
||||
"s1 = s.split(' ') # Разделяет строку по пробелам и преовращает в список слов\n",
|
||||
"print(s1)\n",
|
||||
"\n",
|
||||
"s2 = list(filter(lambda x: x, s1))\n",
|
||||
"print(s2)\n",
|
||||
"\n",
|
||||
"s3 = [x.capitalize() for x in s2] # Преобразует каждое слово в строку с заглавной первой буквой\n",
|
||||
"print(s3)\n",
|
||||
"\n",
|
||||
"s4 = ' '.join(s3) # Соединяет элементы списка в строку, используя ' ' в качестве разделителя\n",
|
||||
"print(s4)\n",
|
||||
"# print(' '.join(['a', 'b', 'c'])) # Соединяет элементы списка в строку, используя пробел в качестве разделителя"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"id": "41ab72cf",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Hello, World!\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"st = ' Hello, World! '\n",
|
||||
"print(st.strip()) # Удаляет пробелы в начале и конце строки"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "7ff78577",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Распаковка и запаковка"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 34,
|
||||
"id": "d39d6026",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"3.0\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"def average(*nums):\n",
|
||||
" return sum(nums) / len(nums) if nums else None\n",
|
||||
"\n",
|
||||
"print(average(1, 2, 3, 4, 5)) # Вывод: 3.0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "e3997fbd",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<a href=\"https://ada-dev.ru\" target=\"_blank\"></a>\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Функция, которая принимает первым аргументом тег, а затем именованные параметры, и возвращает строку в виде HTML-тега с этими параметрами\n",
|
||||
"def create_html(tag, **attributes):\n",
|
||||
" attr_str = ' '.join(f'{key}=\"{value}\"' for key, value in attributes.items())\n",
|
||||
" return f'<{tag} {attr_str}></{tag}>'\n",
|
||||
"\n",
|
||||
"print(create_html('a', href='https://ada-dev.ru', target='_blank'))"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": ".venv",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.14.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
# print('Test')
|
||||
|
||||
# Генераторы массивов
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user