Skip to content

Solution#3366

Closed
sofiia-pohuliailo388 wants to merge 4 commits intomate-academy:masterfrom
sofiia-pohuliailo388:develop
Closed

Solution#3366
sofiia-pohuliailo388 wants to merge 4 commits intomate-academy:masterfrom
sofiia-pohuliailo388:develop

Conversation

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

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 the immutable_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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

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]

Choose a reason for hiding this comment

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

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:

Choose a reason for hiding this comment

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

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 = {

Choose a reason for hiding this comment

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

The task requires the dictionary to be named sorted_variables (plural). Please check the variable name.

app/main.py Outdated
Comment on lines +33 to +34
"immutable": types_detection()[0],
"mutable": types_detection()[1]

Choose a reason for hiding this comment

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

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.

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.

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 multiple type(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 elemets variable 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! ✨

Footnotes

  1. Rate AI review example

Copy link
Author

@sofiia-pohuliailo388 sofiia-pohuliailo388 left a comment

Choose a reason for hiding this comment

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

Review it

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