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}"
Solution
Merci pour vos commentaires !
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
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
Glissez pour afficher le 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}"
Solution
Merci pour vos commentaires !
single