Skip to content

Hw6#7

Open
poluninatm wants to merge 3 commits into
masterfrom
hw6
Open

Hw6#7
poluninatm wants to merge 3 commits into
masterfrom
hw6

Conversation

@poluninatm
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

@Dzhoker1 Dzhoker1 left a comment

Choose a reason for hiding this comment

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

Оставил комментарии по коду

Comment thread task_1.py

if isinstance(var, dict):
memory_size += sys.getsizeof(var)
for i in var:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Для словаря лучше подойдёт for k, v in var:

Comment thread task_1.py


def add_to_memory_size(var):
global memory_size
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 task_1.py
if num % i == 0:
nums_data[i] += 1

add_to_memory_size([RANGE_START, range_stop, nums_data, nums_data.keys(), i, 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.

Надеюсь вы посмотрели урок и "способ 4" из разбора ДЗ. Но и ваш "способ 3" отлично подходит для решения

Comment thread task_1.py

print(f'Память: {memory_size}')

# Вывод
Copy link
Copy Markdown

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