Challenge: Reference Fixer
Swipe to start coding
Complete the function so that you add an item only to the target_list without affecting other_list. Sometimes, both lists may refer to the same underlying object, so be careful to avoid unwanted side effects.
- Check if
target_listandother_listrefer to the same object. - If they do, create a new list for
target_listthat contains the same elements as before. - Add
itemtotarget_list. - Print both lists using these templates:
"Target list: {target_list}""Other list: {other_list}"
Lösung
Danke für Ihr Feedback!
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Can you explain this in simpler terms?
What are some examples related to this topic?
Where can I learn more about this?
Awesome!
Completion rate improved to 5.26
Challenge: Reference Fixer
Swipe um das Menü anzuzeigen
Swipe to start coding
Complete the function so that you add an item only to the target_list without affecting other_list. Sometimes, both lists may refer to the same underlying object, so be careful to avoid unwanted side effects.
- Check if
target_listandother_listrefer to the same object. - If they do, create a new list for
target_listthat contains the same elements as before. - Add
itemtotarget_list. - Print both lists using these templates:
"Target list: {target_list}""Other list: {other_list}"
Lösung
Danke für Ihr Feedback!
single