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}"
Soluzione
Grazie per i tuoi commenti!
single
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione
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
Scorri per mostrare il menu
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}"
Soluzione
Grazie per i tuoi commenti!
single