Skip to content

Conversation

@poluninatm
Copy link
Owner

No description provided.

Copy link

@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.

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


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

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:



def add_to_memory_size(var):
global memory_size
Copy link

Choose a reason for hiding this comment

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

Не стоит злоупотреблять глобальными переменными. Лучше передавать переменную как аргумент функции

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

Choose a reason for hiding this comment

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

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


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

# Вывод
Copy link

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.

3 participants