Skip to content

Develop#3509

Open
Nicholasscientist wants to merge 3 commits into
mate-academy:masterfrom
Nicholasscientist:develop
Open

Develop#3509
Nicholasscientist wants to merge 3 commits into
mate-academy:masterfrom
Nicholasscientist:develop

Conversation

@Nicholasscientist
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

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

Review Summary

Your implementation has two critical issues that must be addressed. First, the task explicitly requires using the exact variable names (lucky_number, pi, one_is_a_prime_number, name, my_favourite_films, profile_info, marks, collection_of_coins) rather than a dynamic approach with dir() and globals(). Second, there's a circular reference bug where sorted_variables incorrectly includes itself in the iteration since dir() returns sorted_variables as a global name. Replace the loop with a direct assignment: sorted_variables = {"mutable": [my_favourite_films, marks, collection_of_coins], "immutable": [lucky_number, pi, one_is_a_prime_number, name, profile_info]}. The dynamic approach, while clever, contradicts the explicit requirement to reference the named variables directly.


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

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread app/main.py Outdated
collection_of_coins = {1, 2, 25}

# write your code here
names = [item for item in dir() if not item.startswith("_")]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This line dynamically gets all global names, which includes more than just the 8 required variables. The task requires using the EXACT variable names from the main module. Consider removing this dynamic approach.

Comment thread app/main.py Outdated
# write your code here
names = [item for item in dir() if not item.startswith("_")]
mutable_types = [list, dict, set]
sorted_variables = {"mutable": [], "immutable": []}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This dictionary will incorrectly include itself in the iteration since sorted_variables is added to names by dir(). The task requires hardcoding references to the 8 specific variables.

Comment thread app/main.py Outdated
Comment on lines +22 to +27
for item in names:
value = globals()[item]
if type(value) in mutable_types:
sorted_variables["mutable"].append(value)
else:
sorted_variables["immutable"].append(value)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This entire loop should be replaced with a direct assignment. The correct implementation should be: sorted_variables = {"mutable": [my_favourite_films, marks, collection_of_coins], "immutable": [lucky_number, pi, one_is_a_prime_number, name, profile_info]}

Copy link
Copy Markdown

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

Review Summary

The implementation correctly creates the sorted_variables dictionary with proper structure, containing two keys ("mutable" and "immutable") where each value is a list with direct variable references (not strings). All 8 variables are properly categorized based on Python's mutability rules—3 mutable types (list, dict, set) and 5 immutable types (int, float, bool, str, tuple). The code meets all requirements from the task checklist.


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

Footnotes

  1. Rate AI review example

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