Skip to content

Первая домашняя работа#1

Open
voobshe wants to merge 1 commit intomasterfrom
homework
Open

Первая домашняя работа#1
voobshe wants to merge 1 commit intomasterfrom
homework

Conversation

@voobshe
Copy link
Owner

@voobshe voobshe commented Mar 6, 2025

Сделала 7 заданий, бот пока не готов.

return "3"
else:
return "0"
print (main(str1, str2))

Choose a reason for hiding this comment

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

смотри, ты два раза за файл вызываешь функцию main() с одними и теми же аргументами
первый раз внутри

 __name__ == "__main__":
     main(str1, str2)

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

 __name__ == "__main__":
     print(main(str1, str2))

чтобы, при вызове файла, у нас не только вызывалась функция main(), но и сразу выводилася на экран результат ее работы

for items in solded_items:
items_sum += items
solded_items_avg = items_sum / len(solded_items)
return solded_items_avg, items_sum

Choose a reason for hiding this comment

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

хорошее решение: вернуть сразу два параметры подсчетов, которые нужны дальше, лайк



for one_product in sales:
one_product_solded_avg, one_product_solded_total = count_average(one_product['items_sold'])

Choose a reason for hiding this comment

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

а тут отличный пример распаковки параметров (именно так называется, когда мы кладем в две переменные последовательно вернувшиеся значения)

"""
pass

def hello_user(user_say):

Choose a reason for hiding this comment

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

совершенно не обязательно в функцию передавать что-то
ты назначаешь пользовательский ввод сначала как 0, а потом в функции его переепределяешь на ввод
гораздо чище будет просто определить ввод в функции:

def hello_user():
  while True:
     user_say = input('Как дела?')
     if user_say == 'Хорошо':
       break


if __name__ == "__main__":
    hello_user()

Проверь, пожалуйста, количество пробелов по умолчанию в своем редакторе
Внутри функции hello_user ты используешь для блоков по 2 пробела вместо положенных 4-х

"""
pass

while True:

Choose a reason for hiding this comment

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

тут внутри тоже по 2 пробела
это не влияет на выполнение кода, но по общим договоренностям мы используем 4

def planet(update, context):
user_text = update.message.text
print(user_text)
update.message.reply_text(text)

Choose a reason for hiding this comment

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

я думаю, тут не доделано задание. Если ты решишь доделать, дай знать, я посмотрю работу еще раз

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

Comments