-
Notifications
You must be signed in to change notification settings - Fork 457
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
Lesson2 #879
base: master
Are you sure you want to change the base?
Lesson2 #879
Conversation
@@ -13,13 +12,34 @@ | |||
|
|||
# Подсказка: воспользоваться методом .format() | |||
|
|||
fruit_pack = ['яблоко', 'банан', 'киви', 'арбуз'] | |||
for i in range(0, len(fruit_pack)): | |||
print(str(i + 1) + '.' + '{:>7}'.format(fruit_pack[i])) |
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.
подумайте что будет если в списке окажется слово которое будет по длине больше чем 7 символов
first_pack = ['1', '2', '3', '4', '5', '6', '7'] | ||
second_pack = ['1', '3', '6'] | ||
for item in second_pack: | ||
if item in first_pack: | ||
first_pack.remove(item) |
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.
вангую, ваше решнеие не будет работать на следующих данных:
first_pack = ['1', '1', '2', '3', '3', '4', '5', '6', '6', '7']
second_pack = ['1', '3', '6']
for key in dic_days: | ||
if date_check[0] == key: | ||
date_check[0] = dic_days[key] | ||
|
||
for key in dic_months: | ||
if date_check[1] == key: | ||
date_check[1] = dic_months[key] |
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.
у вас данные уже в словаре лежат, не нужно по ним итерироваться чтобы достать значения по ключу
if date_check[1] == key: | ||
date_check[1] = dic_months[key] | ||
|
||
print(date_check[0] + ' ' + date_check[1] + ' ' + date_check[2] + ' ' "года") |
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.
забыли про format
Выполнил задания easy и normal