Skip to content

Home work 1#116

Open
StasiaSol wants to merge 4 commits intolearnpythonru:masterfrom
StasiaSol:master
Open

Home work 1#116
StasiaSol wants to merge 4 commits intolearnpythonru:masterfrom
StasiaSol:master

Conversation

@StasiaSol
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@krepysh krepysh left a comment

Choose a reason for hiding this comment

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

Good job! Few little suggestions.

Comment thread 1_if1.py Outdated
elif 7 <= years_old < 17:
stroka = "Человек учиться в школе."
elif 17 <= years_old < 22:
stroka = "Человек учиться в ВУЗе."
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

учится 🙈

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Исправлено

Comment thread 2_if2.py Outdated


def comparison_str(string1, string2):
answer = 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Здесь это объявления переменной не нужно, потому что ее значение не используется.
Или убрать или поставить сюда значение из блока else и убрать его.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Исправлено

Comment thread 3_for.py Outdated
amount_phone["items_sold"]
)
print(middle_num)
all_middle += middle_num
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

кажется среднее средних считается не так 🙈

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Исправила

Comment thread 4_while1.py Outdated
"""
pass
answer = input("Как дела? ")
while answer != "Хорошо":
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Можно упростить

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Исправила

Comment thread 5_while2.py Outdated
"""

questions_and_answers = {}
from pickle import TRUE
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Это не нужно, нужно использовать просто True.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Не совсем поняла, что тут нужно сделать. Можно уточнить этот момент?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Просто убрать этот импорт. По хорошему не должно быть ничего импортировано, что не используется.

Comment thread 5_while2.py Outdated
while sence_bool:
if answers_dict.get(question_in):
print(answers_dict.get(question_in))
sence_bool = False
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Как еще можно прервать цикл? (подсказка: есть оператор break или return)
и можно будет обойтись без булевой переменной.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Исправила

Comment thread 7_exception2.py Outdated
discount = abs(discount)
max_discount = abs(max_discount)
except TypeError:
price = abs(float(price))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Можно вместо двух try-except сделать один. Если сразу делать abs(float(price))
Обычно очень плохая идея выполнять сразу несколько строчек в try-except, но
тут оставь.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Исправила

Comment thread 8_ephem_bot.py Outdated
def planet_mars(update, context):
planet = update.message.text.split()
try:
planet_ephem = getattr(ephem, planet[1].lower().capitalize())(datetime.now())
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Вынеси planet[1].lower().capitalize() в отдельную переменную

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Вынесла в отдельную переменную.

Copy link
Copy Markdown

@krepysh krepysh Sep 16, 2022

Choose a reason for hiding this comment

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

В переменную мы выносим, что бы избежать дублирования кода (в данном случае то как ты "нормализуешь" имя планеты). Написал пару предложений где еще ты можешь заменить код переменной.

Comment thread 8_ephem_bot.py Outdated

constellation = ephem.constellation(planet_ephem)

text = f"Планета {planet[1].lower().capitalize()} находится в {constellation}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
text = f"Планета {planet[1].lower().capitalize()} находится в {constellation}"
text = f"Планета {name_planet} находится в {constellation}"

Comment thread 8_ephem_bot.py Outdated

text = f"Планета {planet[1].lower().capitalize()} находится в {constellation}"
except AttributeError:
text = f"Планета {planet[1].lower().capitalize()} не найдена."
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
text = f"Планета {planet[1].lower().capitalize()} не найдена."
text = f"Планета {name_planet} не найдена."

Comment thread 5_while2.py Outdated
"""

questions_and_answers = {}
from pickle import TRUE
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Просто убрать этот импорт. По хорошему не должно быть ничего импортировано, что не используется.

@StasiaSol
Copy link
Copy Markdown
Author

StasiaSol commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants