Repository navigation
2. Донцов Роман Алексеевич. 613 - #14
Closed
rdontsov01 wants to merge 10 commits into
Closed
rdontsov01 wants to merge 10 commits into
rdontsov01 wants to merge 10 commits into
Conversation
Avshugan
reviewed
Oct 21, 2026
|
|
||
| idx, line = cart_search | ||
| in_cart = line[LINE_QUANTITY_INDEX] | ||
| # 2. Проверка количества в корзине |
Collaborator
There was a problem hiding this comment.
Лучше не экономить строки и оставлять пробелы (пустые строки) между логическими блоками. Тем более что вы уже разделили на блоки комментариями. Так читабельность кода улучшается.
| if remaining_quantity == 0: | ||
| cart.pop(idx) | ||
| return (product_id, 0) | ||
| else: |
| LINE_QUANTITY_INDEX: Final = 1 | ||
|
|
||
|
|
||
| def find_cart_line( |
Collaborator
There was a problem hiding this comment.
Как будто перемудрили. По-моему легче было бы возвращать просто индекс и в коде проверять его на None, а дальше просто в коде делать cart[ind_find_line]. ну либо просто возвращать строку (вроде индекс сам по себе не используется)
Avshugan
reviewed
Oct 22, 2026
| from decimal import Decimal | ||
|
|
||
| from .storage import ( # noqa: F401 | ||
| from .storage import ( |
| # TODO: реализуйте функцию (используйте своё решение части 2) | ||
| return 0 | ||
| """Remove the product stored under ``product_id`` from ``storage``.""" | ||
| for i, p in enumerate(storage): |
Collaborator
There was a problem hiding this comment.
Цикл
for i, p in enumerate(storage):
if p[PRODUCT_ID_INDEX] == product_id:повторяется несколько раз, думаю можно было бы использовать read_product или сделать поиск отдельной функцией
Пункт S1
|
|
||
| command = words[0] | ||
|
|
||
| if command == "exit": |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.