-
Notifications
You must be signed in to change notification settings - Fork 23
Алексей Мерзляков #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jskonst
wants to merge
9
commits into
ISUCT:Aleksej_Merzljakov
Choose a base branch
from
alexeymerz:master
base: Aleksej_Merzljakov
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c4a0aea
Merge pull request #1 from jskonst/master
jskonst 1a28dfb
Merge pull request #2 from jskonst/master
jskonst b693431
Added first lab
jskonst 44d4014
Merge pull request #11 from jskonst/jskonst
jskonst b81fb48
added sample tasks
jskonst d791349
Merge pull request #18 from jskonst/jskonst
jskonst 3f8874d
added sample tests
jskonst 83bf8b9
Merge pull request #22 from jskonst/jskonst
jskonst b22e60c
Мерзляков Алексей
alexeymerz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | ||
| b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] | ||
| result = list(set(a) & set(b)) | ||
| print(result) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| # Tprogramming_2022_zaochn | ||
|
|
||
| Мерзляков Алексей | ||
| ### Установка виртуального окружения | ||
|
|
||
| ```shell | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import unittest | ||
| import task | ||
|
|
||
| class TestSumm(unittest.TestCase): | ||
|
|
||
| def test_positive(self): | ||
| res = task.summ(2, 3) | ||
| self.assertEqual(5, res) | ||
|
|
||
| def test_negative(self): | ||
| res = task.summ(-2, -3) | ||
| self.assertEqual(-5, res) | ||
|
|
||
| def test_first_negative(self): | ||
| res = task.summ(-2, 3) | ||
| self.assertEqual(1, res) | ||
|
|
||
| def test_second_negative(self): | ||
| res = task.summ(2, -3) | ||
| self.assertEqual(-1, res) | ||
|
|
||
| def test_zero(self): | ||
| res = task.summ(0, 0) | ||
| self.assertEqual(0, res) | ||
|
|
||
| if __name__ == '__main__': | ||
| unittest.main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import math | ||
|
|
||
| def summ(a:float, b:float) -> float: | ||
| return a + b | ||
|
|
||
| # def calc(a:float, b: float, x: float) -> float: | ||
| def calc(a, b, x): | ||
| chisl = (math.sin(a + b*x))**3.5 | ||
| znamen = 1 + math.cos(abs(math.log(a + b*x, 2))) | ||
| y = chisl / znamen | ||
| return y | ||
|
|
||
| def task_a(a, b, xn, xk, dx): | ||
| x = xn | ||
| x_arr = [] | ||
| y = [] | ||
| while x <= xk: | ||
| y.append(calc(a, b, x)) | ||
| x_arr.append(x) | ||
| x += dx | ||
| return (x_arr,y) | ||
|
|
||
| def task_b(a, b, x): | ||
| y = [] | ||
| for item in x: | ||
| y.append(calc(a, b, item)) | ||
| return y | ||
|
|
||
| if __name__ == "__main__": | ||
| print(calc(2.5, 4.6, 1.15)) | ||
| x, y = task_a(2.5, 4.6, 1.15, 3.05, 0.38) # (x,y) | ||
| print(x, y) | ||
| y = task_b(2.5, 4.6,[1.2, 1.36, 1.57, 1.93, 2.25]) | ||
| print(y) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import unittest | ||
| import task | ||
|
|
||
| class TestTask(unittest.TestCase): | ||
|
|
||
| def test_calc(self): | ||
| res = task.calc(2.5, 4.6, 1.15) | ||
| self.assertAlmostEqual(61.47, res, 2) | ||
|
|
||
| def test_calc_zeros(self): | ||
| res = task.calc(2.5, 4.6, 0) | ||
| self.assertAlmostEqual(0.13, res, 2) | ||
|
|
||
| def test_task_a_ok(self): | ||
| x, y = task.task_a(2.5, 4.6, 0, 0.5, 0.1) | ||
| self.assertEqual(6, len(x)) | ||
| self.assertEqual(6, len(y)) | ||
|
|
||
| def test_task_a_xk_lt_xn(self): | ||
| x, y = task.task_a(2.5, 4.6, 1, 0, 0.1) | ||
| self.assertEqual(0, len(x)) | ||
| self.assertEqual(0, len(y)) | ||
|
|
||
| def test_task_a_dx_gt_xk(self): | ||
| x, y = task.task_a(2.5, 4.6, 0, 1, 10) | ||
| self.assertEqual(1, len(x)) | ||
| self.assertEqual(1, len(y)) | ||
|
|
||
| def test_task_b_ok(self): | ||
| x = [0, 0.1 , 0.2, 0.3] | ||
| y = task.task_b(2.5, 4.6,x) | ||
| self.assertEqual(len(x), len(y)) | ||
|
|
||
| def test_task_b_empty(self): | ||
| x = [] | ||
| y = task.task_b(2.5, 4.6,x) | ||
| self.assertEqual(0, len(y)) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| unittest.main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| a = [] | ||
| print(a) | ||
| a = [1,2,3,"some", "another", [5,6,"inner"], "last"] | ||
| print(a) | ||
| print(a[0]) | ||
| print(a[6]) | ||
| print(a[5]) | ||
| print(len(a)) | ||
| print(a[len(a)-1]) | ||
| print(a[-1]) | ||
| print(a[:3]) | ||
| print(a[3:-1]) | ||
| print(a[3:]) | ||
|
|
||
| some = a[5] | ||
| print(some[-1]) | ||
|
|
||
| print(a[5][-1]) | ||
|
|
||
| some = [1,2,3] | ||
| copy = [] | ||
| for item in some: | ||
| copy.append(item) | ||
| some.append("added") | ||
| print(some) | ||
| print(copy) | ||
|
|
||
| sample = { "Russia": { | ||
| "capital": "Moscow" | ||
| }, | ||
| "UK": { | ||
| "capital": "London", | ||
| "population": 20000 | ||
| } | ||
| } | ||
| print(sample["Russia"]) | ||
| print(sample["UK"]["population"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Расширение для файла, тесты - ну и хорошо бы обернуть в функцию