Update main.py#3531
Conversation
1st try wo VS
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
The implementation has two critical functional issues that violate the task requirements: 1. sorted_variables must be defined at module level, not inside the sort_variables() function. 2. The dictionary must store actual variable VALUES, not names as strings. 3. Tuples are not classified as immutable and should be included in the mutable types check.
✨ 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
| collection_of_coins = {1, 2, 25} | ||
|
|
||
| # write your code here | ||
| def sort_variables(): |
There was a problem hiding this comment.
The task requires sorted_variables to be a module-level dictionary variable, not inside a function. Compare with the example which shows sorted_variables defined at module level after the variables.
| continue | ||
|
|
||
| if isinstance(value, (list, dict, set)): | ||
| mutable.append(name) |
There was a problem hiding this comment.
The values in the lists should be the actual variable VALUES (e.g., b, d), not the variable names as strings. The example shows sorted_variables = {"mutable": [b, d], ...} using variable references, not string names.
| if name.startswith("__"): | ||
| continue | ||
|
|
||
| if isinstance(value, (list, dict, set)): |
There was a problem hiding this comment.
The isinstance check (list, dict, set) is missing tuple - tuples are immutable and should be included in the immutable list, not mutable. Add tuple to the else branch condition.
| else: | ||
| immutable.append(name) | ||
|
|
||
| sorted_variables = { |
There was a problem hiding this comment.
The variable should be named sorted_variables at module level with the actual variable values, not names as strings. Current approach returns names; it should return values like [b, d, my_favourite_films, marks, collection_of_coins] for mutable.
1st try wo VS