Skip to content

Mutable branch#3355

Open
VictorMatveyshyn wants to merge 4 commits intomate-academy:masterfrom
VictorMatveyshyn:mutable_branch
Open

Mutable branch#3355
VictorMatveyshyn wants to merge 4 commits intomate-academy:masterfrom
VictorMatveyshyn:mutable_branch

Conversation

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

Great job! Your solution correctly sorts all the variables into mutable and immutable types, meeting all the task requirements. I am approving your submission.

As a point for future improvement, consider how you could make the code more concise. The logic for checking each variable is repeated multiple times. You could place all the variables into a list and use a single for loop to iterate through them, which would significantly reduce the amount of repeated code and make it easier to maintain.


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

Footnotes

  1. Rate AI review example

app/main.py Outdated
Comment on lines +29 to +60
if ismutable(lucky_number):
mutable_list.append(lucky_number)
else:
immutable_list.append(lucky_number)
if ismutable(pi):
mutable_list.append(pi)
else:
immutable_list.append(pi)
if ismutable(one_is_a_prime_number):
mutable_list.append(one_is_a_prime_number)
else:
immutable_list.append(one_is_a_prime_number)
if ismutable(name):
mutable_list.append(name)
else:
immutable_list.append(name)
if ismutable(my_favourite_films):
mutable_list.append(my_favourite_films)
else:
immutable_list.append(my_favourite_films)
if ismutable(profile_info):
mutable_list.append(profile_info)
else:
immutable_list.append(profile_info)
if ismutable(marks):
mutable_list.append(marks)
else:
immutable_list.append(marks)
if ismutable(collection_of_coins):
mutable_list.append(collection_of_coins)
else:
immutable_list.append(collection_of_coins)

Choose a reason for hiding this comment

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

This block of code is repeated for each variable. While it works, a more efficient and readable approach would be to use a loop. Consider placing all the variables you need to sort into a list and then iterating through that list with a for loop to check each one and append it to the correct list (mutable_list or immutable_list). This will significantly reduce the amount of repeated code.

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