This repository has been archived by the owner on Oct 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
№22 #13
Open
Lugvlad
wants to merge
3
commits into
ItPeoplePython2018:master
Choose a base branch
from
Lugvlad:patch-4
base: master
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.
+24
−12
Open
№22 #13
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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 |
---|---|---|
|
@@ -5,7 +5,7 @@ def test_even_fucntion(): | |
""" | ||
|
||
def even_filter(*args): | ||
pass | ||
return[i for i in args if i % 2 == 0] | ||
|
||
assert even_filter(1, 2, 3, 4, 5, 6) == [2, 4, 6] | ||
|
||
|
@@ -16,12 +16,13 @@ def test_increment_decorator(): | |
декрорируемую функцию. | ||
""" | ||
def increment_derocator(func): | ||
pass | ||
|
||
def wrapper(value): | ||
func(value+1) | ||
return wrapper | ||
|
||
@increment_derocator | ||
def returner(value): | ||
return value | ||
|
||
assert returner(1) == 2 | ||
|
||
|
||
|
@@ -40,12 +41,16 @@ def __init__(self, x, y): | |
|
||
|
||
class Segment(): | ||
def __init__(self, p1, p2): | ||
pass | ||
|
||
def length(self): | ||
return 0 | ||
|
||
def __init__(self, p1, p2): | ||
pass | ||
self.p1 = p1 | ||
self.p2 = p2 | ||
|
||
def length(self): | ||
|
||
length = math.hypot(self.p1.x - self.p2.x, self.p1.y - self.p2.y) | ||
|
||
return length | ||
p1 = Point(0, 0) | ||
p2 = Point(3, 4) | ||
assert Segment(p1, p2).length() == 5.0 | ||
|
@@ -72,7 +77,14 @@ def test_translate(): | |
Документация по этому методу: https://docs.python.org/3/library/stdtypes.html#str.join | ||
""" | ||
def translate(fraze, dictionary): | ||
pass | ||
def translate(fraze, dic): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Второе объявление функции не нужно (речь о внутренней
|
||
i = fraze.split() | ||
Num = len(i) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
split_fraze = fraze.split()
for word in split_fraze:
tran.append(dic[word]) |
||
Tran=[] | ||
for a in range(Num): | ||
Tran.append(dic[i[a]]) | ||
Translate = " ".join(Tran) | ||
return Translate | ||
|
||
assert translate("hello world", {"hello": "привет", "world": "мир"}) == "привет мир" | ||
assert translate("привет мир", {"привет": "hello", "мир": "world"}) == "hello world" | ||
|
@@ -93,7 +105,7 @@ def test_is_prime(): | |
""" | ||
|
||
def is_prime(n): | ||
pass | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Без тела функции будет синтаксическая ошибка. Нужно либо pass вернуть, либо добавить код для фукнции. |
||
|
||
assert is_prime(2) | ||
assert is_prime(3) | ||
|
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.
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.
pass
больше не нужен - у нас уже появился код для метода__init__