Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sem3-ivt19-task1-1-mozgovoy
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
Мозговой Никита Александрович
sem3-ivt19-task1-1-mozgovoy
Commits
222df306
Commit
222df306
authored
Nov 09, 2020
by
Мозговой Никита Александрович
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lr5
parent
c476f98e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
calculate.py
calculate.py
+8
-8
No files found.
calculate.py
View file @
222df306
...
@@ -19,31 +19,31 @@ def calculate(*args, **kwargs):
...
@@ -19,31 +19,31 @@ def calculate(*args, **kwargs):
output_type
=
kwargs
[
'output_type'
]
output_type
=
kwargs
[
'output_type'
]
print
(
precision
)
print
(
precision
)
if
args
[
len
(
args
)
-
1
]
==
'+'
:
if
args
[
args
[
-
1
]
]
==
'+'
:
result_sum
=
sum
(
args
[
0
:
len
(
args
)
-
1
])
result_sum
=
sum
(
args
[
0
:
args
[
-
1
]
])
if
type
(
result_sum
)
is
not
output_type
:
if
type
(
result_sum
)
is
not
output_type
:
result_sum
=
output_type
(
result_sum
)
result_sum
=
output_type
(
result_sum
)
return
result_sum
return
result_sum
if
args
[
len
(
args
)
-
1
]
==
'-'
:
if
args
[
args
[
-
1
]
]
==
'-'
:
result_diff
=
0
result_diff
=
0
for
n
in
args
[
0
:
len
(
args
)
-
1
]:
for
n
in
args
[
0
:
args
[
-
1
]
]:
result_diff
-=
n
result_diff
-=
n
if
type
(
result_diff
)
is
not
output_type
:
if
type
(
result_diff
)
is
not
output_type
:
result_sum
=
output_type
(
result_diff
)
result_sum
=
output_type
(
result_diff
)
return
result_diff
return
result_diff
if
args
[
len
(
args
)
-
1
]
==
'*'
:
if
args
[
args
[
-
1
]
]
==
'*'
:
result_mult
=
1
result_mult
=
1
for
n
in
args
[
0
:
len
(
args
)
-
1
]:
for
n
in
args
[
0
:
args
[
-
1
]
]:
result_mult
*=
n
result_mult
*=
n
if
type
(
result_mult
)
is
not
output_type
:
if
type
(
result_mult
)
is
not
output_type
:
result_mult
=
output_type
(
result_mult
)
result_mult
=
output_type
(
result_mult
)
return
round
(
result_mult
,
precision
)
return
round
(
result_mult
,
precision
)
if
args
[
len
(
args
)
-
1
]
==
'/'
:
if
args
[
args
[
-
1
]
]
==
'/'
:
result_division
=
args
[
0
]
result_division
=
args
[
0
]
for
n
in
args
[
1
:
len
(
args
)
-
1
]:
for
n
in
args
[
1
:
args
[
-
1
]
]:
result_division
/=
n
result_division
/=
n
if
type
(
result_division
)
is
not
output_type
:
if
type
(
result_division
)
is
not
output_type
:
result_division
=
output_type
(
result_division
)
result_division
=
output_type
(
result_division
)
...
...
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