Skip to content

2. Донцов Роман Алексеевич. 613 - #14

Closed
rdontsov01 wants to merge 10 commits into
python-department:mainfrom
rdontsov01:main
Closed

rdontsov01 wants to merge 10 commits into
python-department:mainfrom
rdontsov01:main

Conversation

@rdontsov01

Copy link
Copy Markdown

No description provided.

@github-actions github-actions Bot added the 613 label Sep 22, 2026
@rdontsov01 rdontsov01 changed the title 1. Донцов Роман Алексеевич. 613 2. Донцов Роман Алексеевич. 613 Oct 2, 2026
@rdontsov01 rdontsov01 closed this Oct 9, 2026
@rdontsov01 rdontsov01 reopened this Oct 9, 2026
Comment thread src/part2/cart.py

idx, line = cart_search
in_cart = line[LINE_QUANTITY_INDEX]
# 2. Проверка количества в корзине

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Comment thread src/part2/cart.py
if remaining_quantity == 0:
cart.pop(idx)
return (product_id, 0)
else:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Пункт Т1

Comment thread src/part2/cart.py
LINE_QUANTITY_INDEX: Final = 1


def find_cart_line(

@Avshugan Avshugan Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Как будто перемудрили. По-моему легче было бы возвращать просто индекс и в коде проверять его на None, а дальше просто в коде делать cart[ind_find_line]. ну либо просто возвращать строку (вроде индекс сам по себе не используется)

Comment thread src/part3/crud.py
from decimal import Decimal

from .storage import ( # noqa: F401
from .storage import (

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ruff и mypy не проходят

Comment thread src/part3/crud.py
# TODO: реализуйте функцию (используйте своё решение части 2)
return 0
"""Remove the product stored under ``product_id`` from ``storage``."""
for i, p in enumerate(storage):

@Avshugan Avshugan Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Цикл

for i, p in enumerate(storage):
        if p[PRODUCT_ID_INDEX] == product_id:

повторяется несколько раз, думаю можно было бы использовать read_product или сделать поиск отдельной функцией
Пункт S1

Comment thread src/part3/run_admin.py

command = words[0]

if command == "exit":

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

match case был бы проще

@rdontsov01 rdontsov01 closed this Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants