-
Notifications
You must be signed in to change notification settings - Fork 0
Hw6 #7
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
base: master
Are you sure you want to change the base?
Hw6 #7
Conversation
Dzhoker1
left a comment
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 isinstance(var, dict): | ||
| memory_size += sys.getsizeof(var) | ||
| for i in var: |
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.
Для словаря лучше подойдёт for k, v in var:
|
|
||
|
|
||
| def add_to_memory_size(var): | ||
| global memory_size |
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 num % i == 0: | ||
| nums_data[i] += 1 | ||
|
|
||
| add_to_memory_size([RANGE_START, range_stop, nums_data, nums_data.keys(), i, num]) |
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.
Надеюсь вы посмотрели урок и "способ 4" из разбора ДЗ. Но и ваш "способ 3" отлично подходит для решения
|
|
||
| print(f'Память: {memory_size}') | ||
|
|
||
| # Вывод |
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.
В целом отличная работа
No description provided.