Skip to content
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

'Solution' #2005

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

'Solution' #2005

wants to merge 1 commit into from

Conversation

Bogdannna7
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Great job on implementing the function to categorize variables into mutable and immutable types! 🎉 Your solution meets the task requirements and works as expected. While your use of globals() is correct, remember that it includes all global variables, so be mindful of filtering them if necessary. Also, consider the uniqueness of variable values when using list comprehensions to avoid unexpected results. Keep up the good work and happy coding! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +23 to +24
variables_dict = {key : value for key, value in globals().items()
if not key.startswith("__")}

Choose a reason for hiding this comment

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

The use of globals() is correct for accessing global variables, but be cautious as it includes all global variables, which might not be intended. Consider filtering the variables more specifically if needed.

Comment on lines +30 to +31
var_name = [key for key, value in variables_dict.items()
if value is arg]

Choose a reason for hiding this comment

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

The list comprehension is used to find the variable name corresponding to the argument. This works, but it assumes that the variable values are unique, which might not always be the case. If two variables have the same value, this could lead to unexpected results.

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