Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
This requires a few changes before it can be approved. You've set up the overall structure well, but there are several critical issues that prevent the code from meeting the requirements and producing the correct output.
Here’s what you need to fix:
- Incomplete Data: One of the 8 predefined variables is missing from the list you are sorting. Make sure to include all of them.
- Incorrect Type Check: Your condition for immutable types is missing a check for
str. Since strings are immutable in Python, they should be added to theimmutable_list. - Duplicate Results: You are calling the
types_detection()function twice. This causes every item to be processed and added to the lists a second time. Please call the function only once. - Incorrect Variable Name: The final dictionary must be named
sorted_variables(plural), as specified in the task requirements.
Once you've addressed these points, your solution should work as expected. You're close!
✨ 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
app/main.py
Outdated
| # write your code here | ||
| mutable_list= [] | ||
| immutable_list = [] | ||
| elemets = [lucky_number, pi, one_is_a_prime_number, my_favourite_films, profile_info, marks, collection_of_coins] |
There was a problem hiding this comment.
It seems one of the 8 predefined variables is missing from this list. Make sure to include all of them to be sorted.
app/main.py
Outdated
|
|
||
| def types_detection(): | ||
| for element in elemets: | ||
| if type(element) == int or type(element) == float or type(element) == bool or type(element) == tuple: |
There was a problem hiding this comment.
Your condition is missing a check for the str type. Strings are immutable in Python and should be included in the immutable_list.
app/main.py
Outdated
|
|
||
| return immutable_list, mutable_list | ||
|
|
||
| sorted_variable = { |
There was a problem hiding this comment.
The task requires the dictionary to be named sorted_variables (plural). Please check the variable name.
app/main.py
Outdated
| "immutable": types_detection()[0], | ||
| "mutable": types_detection()[1] |
There was a problem hiding this comment.
Calling types_detection() twice here is problematic. Since the function modifies global lists (immutable_list, mutable_list), the second call appends the same elements again, creating duplicates. You should call the function only once, save its result, and then use that result to build your dictionary.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work addressing the feedback from the last review! Your code now meets all the functional requirements, correctly sorting all variables into the sorted_variables dictionary. I am approving your solution based on the correct logic.
Before you move on, please review the feedback from the automated flake8 check. It has highlighted a few important Python best practices that you should incorporate:
- Type Checking: Use
isinstance(element, (int, str, ...))instead of multipletype(element) == ...checks. It's more efficient and robust. - Readability: Some lines are too long (over 79 characters), and there's a small typo in the
elemetsvariable name.
Fixing these style issues is a great habit for writing clean, professional code. Great job overall!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.