Skip to content
This repository has been archived by the owner on Oct 16, 2019. It is now read-only.

№22 #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

№22 #13

wants to merge 3 commits into from

Conversation

Lugvlad
Copy link

@Lugvlad Lugvlad commented Jun 22, 2018

No description provided.

Copy link
Contributor

@wronglink wronglink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Из-за переименования файла с тестами homework/tests.py → homework/№22, теперь они не запустятся (об этом сообщает pytest https://travis-ci.org/ItPeoplePython2018/lesson-1/builds/395512839)

return 0

def __init__(self, p1, p2):
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass больше не нужен - у нас уже появился код для метода __init__

pass
def translate(fraze, dic):
i = fraze.split()
Num = len(i)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Num, Tran, Translate - не python-стиль. Стоит переименовать в num, т.к. CamelCase закреплен за именами классов.
  2. Не обязательно итерироваться по индексам элементов в списке, можно сразу по этим элементам итерироваться:
split_fraze = fraze.split()
for word in split_fraze:
    tran.append(dic[word])

@@ -93,7 +105,7 @@ def test_is_prime():
"""

def is_prime(n):
pass

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Без тела функции будет синтаксическая ошибка. Нужно либо pass вернуть, либо добавить код для фукнции.

@@ -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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Второе объявление функции не нужно (речь о внутренней def translate(fraze, dic):)

def translate(fraze, dictionary):
    def translate(fraze, dic):

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants