Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
ode-solver-2021
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Величко Арсений Александрович
ode-solver-2021
Commits
fa4d8ac8
You need to sign in or sign up before continuing.
Commit
fa4d8ac8
authored
Dec 25, 2021
by
Величко Арсений Александрович
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added comments
parent
74413fa9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
main.py
src/main.py
+11
-1
No files found.
src/main.py
View file @
fa4d8ac8
...
...
@@ -34,6 +34,7 @@ ALL_FUNCTIONS = [
def
list_methods
()
->
None
:
"""вывести все доступные методы"""
headers
=
[
"№"
,
"Название метода"
]
method_names
=
[
method
.
__doc__
for
method
in
ALL_METHODS
]
method_table
=
tabulate
(
...
...
@@ -45,6 +46,7 @@ def list_methods() -> None:
def
list_functions
()
->
None
:
"""вывести все доступные функции"""
headers
=
[
"№"
,
"Функция"
]
function_names
=
[
function
.
__doc__
for
function
in
ALL_FUNCTIONS
]
function_table
=
tabulate
(
...
...
@@ -56,11 +58,14 @@ def list_functions() -> None:
def
main
()
->
None
:
"""интерактивный консольный интерфейс"""
typer
.
echo
(
"ЛР1: Система решения ОДУ"
)
typer
.
echo
(
"Работу выполнили: Величко А.А., Галкин И.Ю., Егоров С.А., Адаев Р.М. ИВТ 2 курс
\n
"
)
# вывести все доступные методы
list_methods
()
# ввести номер необходимого метода
while
True
:
method_num
:
int
=
typer
.
prompt
(
"Выберите метод из списка и введите его номер"
,
type
=
int
)
if
1
<=
method_num
<=
len
(
ALL_METHODS
):
...
...
@@ -70,7 +75,10 @@ def main() -> None:
method
=
ALL_METHODS
[
method_num
-
1
]
typer
.
echo
(
f
"Выбран метод: {method.__doc__}"
)
# вывести все доступные функции
list_functions
()
# ввести номер необходимой функции
while
True
:
function_num
:
int
=
typer
.
prompt
(
"Выберите функцию из списка и введите её номер"
,
type
=
int
)
if
1
<=
function_num
<=
len
(
ALL_FUNCTIONS
):
...
...
@@ -80,11 +88,13 @@ def main() -> None:
function
=
ALL_FUNCTIONS
[
function_num
-
1
]
typer
.
echo
(
f
"Выбрана функция: {function.__doc__}"
)
# ввести аргументы
a
:
float
=
typer
.
prompt
(
"Нижний предел интегрирования"
,
type
=
float
)
b
:
float
=
typer
.
prompt
(
"Верхний предел интегрирования"
,
type
=
float
)
n
:
float
=
typer
.
prompt
(
"Кол-во разбиений"
,
type
=
int
)
result
:
float
=
method
(
function
,
a
,
b
,
n
)
# произвести вычисления и вывести результат
result
:
float
=
method
(
function
,
a
,
b
,
n
)
typer
.
echo
(
f
"Результат вычислений: {result}
\n
"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment