Initial commit
This commit is contained in:
		
						commit
						d27394b502
					
				
							
								
								
									
										126
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,126 @@
 | 
			
		||||
# devmusor
 | 
			
		||||
test_module/
 | 
			
		||||
 | 
			
		||||
# Byte-compiled / optimized / DLL files
 | 
			
		||||
__pycache__/
 | 
			
		||||
*.py[cod]
 | 
			
		||||
*$py.class
 | 
			
		||||
 | 
			
		||||
# C extensions
 | 
			
		||||
*.so
 | 
			
		||||
 | 
			
		||||
# Distribution / packaging
 | 
			
		||||
.Python
 | 
			
		||||
build/
 | 
			
		||||
develop-eggs/
 | 
			
		||||
dist/
 | 
			
		||||
downloads/
 | 
			
		||||
eggs/
 | 
			
		||||
.eggs/
 | 
			
		||||
lib/
 | 
			
		||||
lib64/
 | 
			
		||||
parts/
 | 
			
		||||
sdist/
 | 
			
		||||
var/
 | 
			
		||||
wheels/
 | 
			
		||||
pip-wheel-metadata/
 | 
			
		||||
share/python-wheels/
 | 
			
		||||
*.egg-info/
 | 
			
		||||
.installed.cfg
 | 
			
		||||
*.egg
 | 
			
		||||
MANIFEST
 | 
			
		||||
 | 
			
		||||
# PyInstaller
 | 
			
		||||
#  Usually these files are written by a python script from a template
 | 
			
		||||
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
 | 
			
		||||
*.manifest
 | 
			
		||||
 | 
			
		||||
# Installer logs
 | 
			
		||||
pip-log.txt
 | 
			
		||||
pip-delete-this-directory.txt
 | 
			
		||||
 | 
			
		||||
# Unit test / coverage reports
 | 
			
		||||
htmlcov/
 | 
			
		||||
.tox/
 | 
			
		||||
.nox/
 | 
			
		||||
.coverage
 | 
			
		||||
.coverage.*
 | 
			
		||||
.cache
 | 
			
		||||
nosetests.xml
 | 
			
		||||
coverage.xml
 | 
			
		||||
*.cover
 | 
			
		||||
.hypothesis/
 | 
			
		||||
.pytest_cache/
 | 
			
		||||
 | 
			
		||||
# Translations
 | 
			
		||||
*.mo
 | 
			
		||||
*.pot
 | 
			
		||||
 | 
			
		||||
# Django stuff:
 | 
			
		||||
*.log
 | 
			
		||||
local_settings.py
 | 
			
		||||
db.sqlite3
 | 
			
		||||
db.sqlite3-journal
 | 
			
		||||
 | 
			
		||||
# Flask stuff:
 | 
			
		||||
instance/
 | 
			
		||||
.webassets-cache
 | 
			
		||||
 | 
			
		||||
# Scrapy stuff:
 | 
			
		||||
.scrapy
 | 
			
		||||
 | 
			
		||||
# Sphinx documentation
 | 
			
		||||
docs/_build/
 | 
			
		||||
 | 
			
		||||
# PyBuilder
 | 
			
		||||
target/
 | 
			
		||||
 | 
			
		||||
# Jupyter Notebook
 | 
			
		||||
.ipynb_checkpoints
 | 
			
		||||
 | 
			
		||||
# IPython
 | 
			
		||||
profile_default/
 | 
			
		||||
ipython_config.py
 | 
			
		||||
 | 
			
		||||
# pyenv
 | 
			
		||||
.python-version
 | 
			
		||||
 | 
			
		||||
# pipenv
 | 
			
		||||
#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
 | 
			
		||||
#   However, in case of collaboration, if having platform-specific dependencies or dependencies
 | 
			
		||||
#   having no cross-platform support, pipenv may install dependencies that don't work, or not
 | 
			
		||||
#   install all needed dependencies.
 | 
			
		||||
#Pipfile.lock
 | 
			
		||||
 | 
			
		||||
# celery beat schedule file
 | 
			
		||||
celerybeat-schedule
 | 
			
		||||
 | 
			
		||||
# SageMath parsed files
 | 
			
		||||
*.sage.py
 | 
			
		||||
 | 
			
		||||
# Environments
 | 
			
		||||
.env
 | 
			
		||||
.venv
 | 
			
		||||
env/
 | 
			
		||||
venv/
 | 
			
		||||
ENV/
 | 
			
		||||
env.bak/
 | 
			
		||||
venv.bak/
 | 
			
		||||
 | 
			
		||||
# Spyder project settings
 | 
			
		||||
.spyderproject
 | 
			
		||||
.spyproject
 | 
			
		||||
 | 
			
		||||
# Rope project settings
 | 
			
		||||
.ropeproject
 | 
			
		||||
 | 
			
		||||
# mkdocs documentation
 | 
			
		||||
/site
 | 
			
		||||
 | 
			
		||||
# mypy
 | 
			
		||||
.mypy_cache/
 | 
			
		||||
.dmypy.json
 | 
			
		||||
dmypy.json
 | 
			
		||||
 | 
			
		||||
# Pyre type checker
 | 
			
		||||
.pyre/
 | 
			
		||||
							
								
								
									
										83
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,83 @@
 | 
			
		||||
metodi
 | 
			
		||||
=============
 | 
			
		||||
 | 
			
		||||
bts metodi 1
 | 
			
		||||
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
### Windows
 | 
			
		||||
 | 
			
		||||
1. *Installing Git and Python:*
 | 
			
		||||
 | 
			
		||||
*   [Git for Windows](https://git-scm.com/downloads/)
 | 
			
		||||
*   [Download python 3.x](https://www.python.org/downloads/)
 | 
			
		||||
 | 
			
		||||
2. *Cloning the Repository:*
 | 
			
		||||
 | 
			
		||||
        git clone https://git.dota2.pw/cheykrym/metodi.git
 | 
			
		||||
        cd metodi
 | 
			
		||||
 | 
			
		||||
3. *Creating a Virtual Environment:*
 | 
			
		||||
 | 
			
		||||
        python -m venv env
 | 
			
		||||
 | 
			
		||||
4. *Installing Dependencies:*
 | 
			
		||||
 | 
			
		||||
        .\env\Scripts\pip.exe install -r .\requirements.txt
 | 
			
		||||
 | 
			
		||||
5. *Running the Project:*
 | 
			
		||||
 | 
			
		||||
        .\env\Scripts\python.exe .\main.py
 | 
			
		||||
 | 
			
		||||
### Mac
 | 
			
		||||
 | 
			
		||||
1. *Installing Git and Python:*
 | 
			
		||||
 | 
			
		||||
        -
 | 
			
		||||
 | 
			
		||||
2. *Cloning the Repository:*
 | 
			
		||||
 | 
			
		||||
        git clone https://git.dota2.pw/cheykrym/metodi.git
 | 
			
		||||
        cd metodi
 | 
			
		||||
 | 
			
		||||
3. *Creating a Virtual Environment:*
 | 
			
		||||
 | 
			
		||||
        python3 -m venv env
 | 
			
		||||
 | 
			
		||||
4. *Installing Dependencies:*
 | 
			
		||||
 | 
			
		||||
        . ./env/bin/activate
 | 
			
		||||
        pip3 install -r requirements.txt
 | 
			
		||||
        deactivate       
 | 
			
		||||
 | 
			
		||||
5. *Running the Project:*
 | 
			
		||||
 | 
			
		||||
        env/bin/python3 main.py
 | 
			
		||||
 | 
			
		||||
### Linux
 | 
			
		||||
 | 
			
		||||
1. *Installing Git and Python:*
 | 
			
		||||
 | 
			
		||||
        sudo apt update
 | 
			
		||||
        sudo apt -y install git
 | 
			
		||||
        sudo apt -y install python3
 | 
			
		||||
        sudo apt -y install python3-pip
 | 
			
		||||
 | 
			
		||||
2. *Cloning the Repository:*
 | 
			
		||||
 | 
			
		||||
        git clone https://git.dota2.pw/cheykrym/metodi.git
 | 
			
		||||
        cd metodi
 | 
			
		||||
 | 
			
		||||
3. *Creating a Virtual Environment:*
 | 
			
		||||
 | 
			
		||||
        python3 -m venv env
 | 
			
		||||
 | 
			
		||||
4. *Installing Dependencies:*
 | 
			
		||||
 | 
			
		||||
        . ./env/bin/activate
 | 
			
		||||
        pip3 install -r requirements.txt
 | 
			
		||||
        deactivate
 | 
			
		||||
 | 
			
		||||
5. *Running the Project:*
 | 
			
		||||
 | 
			
		||||
        env/bin/python3 main.py
 | 
			
		||||
							
								
								
									
										0
									
								
								app/labs/lab1.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								app/labs/lab1.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								app/labs/lab2.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								app/labs/lab2.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								app/labs/lab3.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								app/labs/lab3.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								app/labs/lab4.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								app/labs/lab4.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								app/labs/lab5.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								app/labs/lab5.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										59
									
								
								app/labs/labTest.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								app/labs/labTest.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,59 @@
 | 
			
		||||
import math
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class labTest:
 | 
			
		||||
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
        pass  # Конструктор пока пустой, при необходимости можно добавить параметры
 | 
			
		||||
 | 
			
		||||
    def calc_roots(self, a, b, c):
 | 
			
		||||
        if a == 0:
 | 
			
		||||
            raise ValueError("Невозможно найти корни, так как уравнение не является квадратным.")
 | 
			
		||||
        
 | 
			
		||||
        # дискриминант
 | 
			
		||||
        discriminant = b ** 2 - 4 * a * c
 | 
			
		||||
        print(f"Дискриминант равен {discriminant:.2f}, ", end='')
 | 
			
		||||
        
 | 
			
		||||
        if discriminant > 0:
 | 
			
		||||
            print("уравнение имеет 2 различных вещественных корня.")
 | 
			
		||||
            # Два различных корня
 | 
			
		||||
            x1 = (-b + math.sqrt(discriminant)) / (2 * a)
 | 
			
		||||
            x2 = (-b - math.sqrt(discriminant)) / (2 * a)
 | 
			
		||||
            return [round(x1, 2), round(x2, 2)]
 | 
			
		||||
        
 | 
			
		||||
        elif discriminant == 0:
 | 
			
		||||
            print("уравнение имеет 1 вещественный корень.")
 | 
			
		||||
            # Один корень
 | 
			
		||||
            x = -b / (2 * a)
 | 
			
		||||
            return [round(x, 2)]
 | 
			
		||||
        
 | 
			
		||||
        else:
 | 
			
		||||
            print("уравнение не имеет вещественных корней.")
 | 
			
		||||
            # Нет вещественных корней
 | 
			
		||||
            return []
 | 
			
		||||
 | 
			
		||||
    # Коэффициенты уравнения
 | 
			
		||||
    # a, b, c = 0, -3, 2 // 1 -3 2
 | 
			
		||||
 | 
			
		||||
    def main(self, a, b, c):
 | 
			
		||||
        try:
 | 
			
		||||
            X = self.calc_roots(a, b, c)
 | 
			
		||||
            if X:
 | 
			
		||||
                print(f"Корни уравнения: {', '.join(map(str, X))}.")
 | 
			
		||||
            else:
 | 
			
		||||
                print("Корни уравнения отсутствуют.")
 | 
			
		||||
        except ValueError as e:
 | 
			
		||||
            print(e)
 | 
			
		||||
 | 
			
		||||
    def start(self):
 | 
			
		||||
        try:
 | 
			
		||||
            a = int(input("Введите a: "))
 | 
			
		||||
            b = int(input("Введите b: "))
 | 
			
		||||
            c = int(input("Введите c: "))
 | 
			
		||||
            self.main(a, b, c)
 | 
			
		||||
        except ValueError:
 | 
			
		||||
            print("Ошибка ввода: необходимо ввести целые числа для a, b и c.")
 | 
			
		||||
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
    lab_test = labTest()
 | 
			
		||||
    lab_test.start()
 | 
			
		||||
							
								
								
									
										72
									
								
								app/menu_load.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								app/menu_load.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,72 @@
 | 
			
		||||
from app.utils.system import clear_console
 | 
			
		||||
 | 
			
		||||
# from app.zadachi.lab1 import lab1
 | 
			
		||||
# from app.zadachi.lab2 import lab2
 | 
			
		||||
# from app.zadachi.lab3 import lab3
 | 
			
		||||
# from app.zadachi.lab4 import lab4
 | 
			
		||||
# from app.zadachi.lab5 import lab5
 | 
			
		||||
# from app.zadachi.lab6 import lab6
 | 
			
		||||
# from app.zadachi.lab7 import lab7
 | 
			
		||||
from app.labs.labTest import labTest
 | 
			
		||||
 | 
			
		||||
class menu:
 | 
			
		||||
    
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
        pass  # Конструктор пока пустой, при необходимости можно добавить параметры
 | 
			
		||||
 | 
			
		||||
    def main_menu(self):
 | 
			
		||||
        clear_console()
 | 
			
		||||
        while True:
 | 
			
		||||
            print('\nMain Menu:')
 | 
			
		||||
            print('1. Задача 1 (Не работает)')
 | 
			
		||||
            print('2. Задача 2 (Не работает)')
 | 
			
		||||
            print('3. Задача 3 (Не работает)')
 | 
			
		||||
            print('4. Задача 4 (Не работает)')
 | 
			
		||||
            print('5. Задача 5 (Не работает)')
 | 
			
		||||
            print('6. Задача 6 (Не работает)')
 | 
			
		||||
            print('7. Задача 7 (Не работает)')
 | 
			
		||||
            print('8. Задача Test')
 | 
			
		||||
            print('0. Exit')
 | 
			
		||||
 | 
			
		||||
            choice = input('Select an option: ')
 | 
			
		||||
 | 
			
		||||
            clear_console()
 | 
			
		||||
            if choice == '1':
 | 
			
		||||
                pass
 | 
			
		||||
            # elif choice == '2':
 | 
			
		||||
            #     self.lab2_menu()  # Переход к подменю Задачи 2
 | 
			
		||||
            # elif choice == '3':
 | 
			
		||||
            #     self.lab3_menu()  # Переход к подменю Задачи 3
 | 
			
		||||
            # elif choice == '4':
 | 
			
		||||
            #     self.lab4_menu()  # Добавлен вызов меню задачи 4
 | 
			
		||||
            elif choice == '8':
 | 
			
		||||
                self.labTest_menu()  # Добавлен вызов меню задачи 5
 | 
			
		||||
            elif choice == '0':
 | 
			
		||||
                print('Exiting program...')
 | 
			
		||||
                break
 | 
			
		||||
            else:
 | 
			
		||||
                print('Invalid option')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    def labTest_menu(self):
 | 
			
		||||
        """Меню для задачи Тест"""
 | 
			
		||||
        clear_console()
 | 
			
		||||
        lT = labTest()
 | 
			
		||||
        
 | 
			
		||||
        while True:
 | 
			
		||||
            print('\nЗадача Тест:')
 | 
			
		||||
            print('1. Рассчитать значение дискриминанта и по результату выдать в консоль сообщение, сколько вещественных корней имеет уравнение.')
 | 
			
		||||
            print('0. Назад')
 | 
			
		||||
 | 
			
		||||
            choice = input('Выберите подкатегорию: ')
 | 
			
		||||
 | 
			
		||||
            clear_console()
 | 
			
		||||
 | 
			
		||||
            if choice == '1':
 | 
			
		||||
 | 
			
		||||
                lT.start()
 | 
			
		||||
            elif choice == '0':
 | 
			
		||||
                break
 | 
			
		||||
            else:
 | 
			
		||||
                print('Неверный выбор, попробуйте снова.')
 | 
			
		||||
							
								
								
									
										1
									
								
								app/utils/config.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								app/utils/config.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
debug=0
 | 
			
		||||
							
								
								
									
										10
									
								
								app/utils/system.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								app/utils/system.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
			
		||||
import os
 | 
			
		||||
import platform
 | 
			
		||||
 | 
			
		||||
def clear_console():
 | 
			
		||||
    """Очистить консоль в зависимости от операционной системы."""
 | 
			
		||||
    os_name = platform.system()
 | 
			
		||||
    if os_name == 'Windows':
 | 
			
		||||
        os.system('cls')
 | 
			
		||||
    else:
 | 
			
		||||
        os.system('clear')
 | 
			
		||||
							
								
								
									
										11
									
								
								main.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								main.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,11 @@
 | 
			
		||||
from app.utils.config import debug
 | 
			
		||||
from app.menu_load import menu
 | 
			
		||||
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
    if debug == True:
 | 
			
		||||
        print("Running in debug mode...")
 | 
			
		||||
        from test_module.debug_main import debug_main_start
 | 
			
		||||
        debug_main_start()
 | 
			
		||||
    else:
 | 
			
		||||
        mn = menu()
 | 
			
		||||
        mn.main_menu()
 | 
			
		||||
							
								
								
									
										2
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,2 @@
 | 
			
		||||
numpy==2.1.2
 | 
			
		||||
matplotlib==3.9.2
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user