-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Solution1 #3146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Solution1 #3146
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Summary
I am requesting changes because the submission does not meet the core requirements of the task. While your code correctly demonstrates the concept of mutable vs. immutable types, it misses the main goal.
The task requires you to create a specific dictionary named sorted_variables. This dictionary should contain two keys, "mutable" and "immutable", with their values being lists of 8 pre-existing variables sorted into the correct category.
Please review the task description carefully and implement the logic to define the variables and populate the sorted_variables dictionary as required.
✨ 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
| def demonstrate_mutability(): | ||
| # 1. Незмінні об'єкти (Immutable) | ||
| print("--- Immutable Objects (int) ---") | ||
| age = 18 | ||
| old_id = id(age) | ||
| print(f"Початковий age: {age}, id: {old_id}") | ||
|
|
||
| age += 1 # Створюється новий об'єкт | ||
| new_id = id(age) | ||
| print(f"Змінений age: {age}, id: {new_id}") | ||
| print(f"Чи змінився id? {old_id != new_id} (Так, бо це новий об'єкт)\n") | ||
|
|
||
| # 2. Змінні об'єкти (Mutable) | ||
| print("--- Mutable Objects (list) ---") | ||
| my_list = [1, 2, 3] | ||
| list_id = id(my_list) | ||
| print(f"Початковий список: {my_list}, id: {list_id}") | ||
|
|
||
| my_list.append(4) # Об'єкт змінюється на місці | ||
| print(f"Змінений список: {my_list}, id: {id(my_list)}") | ||
| print(f"Чи залишився id тим самим? {list_id == id(my_list)} (Так)\n") | ||
|
|
||
| # 3. Передача у функцію | ||
| print("--- Function behavior ---") | ||
|
|
||
| def modify_objects(lst, string): | ||
| lst.append("new_element") | ||
| string += " appended text" | ||
| print(f"Всередині функції - список: {lst}") | ||
| print(f"Всередині функції - рядок: {string}") | ||
|
|
||
| fruits = ["apple", "banana"] | ||
| text = "Hello" | ||
|
|
||
| print(f"До функції: fruits={fruits}, text='{text}'") | ||
| modify_objects(fruits, text) | ||
| print(f"Після функції: fruits={fruits}, text='{text}'") | ||
| print("Результат: Список змінився поза функцією, а рядок — ні.") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| demonstrate_mutability() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems there's a misunderstanding of the task requirements. The goal is to create a dictionary named sorted_variables that categorizes 8 pre-existing variables into 'mutable' and 'immutable' lists. The current code demonstrates the concept of mutability but doesn't implement the required sorting logic or create the specified dictionary.
mateacademy-ai-mentor
left a comment
There was a problem hiding this 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 on this submission! I am approving your solution as you've successfully addressed all the previous feedback and met every requirement of the task. The sorted_variables dictionary is now perfectly implemented, correctly sorting all the variables into the mutable and immutable lists. Great job demonstrating your understanding of data types in Python. Keep up the fantastic work!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.