Python Quiz # 3 What is the output of this code snippet? A) ['abc', 'y', 'z'] B) [1, 2, 3] C) ['x', 'y', 'z'] D) All of the above Answer for Quiz # 2 in the thread 🧵👇
If you have missed previous quizzes in this series, don't worry! You can follow this link and go back to quiz 1.
That's a wrap! I hope you learnt something new today. Follow me @python_spaces for more such content. Like and RT the first tweet to share with your friends. Cheers 🎉
Python Quiz # 3 What is the output of this code snippet? A) ['abc', 'y', 'z'] B) [1, 2, 3] C) ['x', 'y', 'z'] D) All of the above Answer for Quiz # 2 in the thread 🧵👇
Hope it's useful. I am going to share more quizzes in this series.
C) ['x', 'y', 'z'] For the benefit of those that wish to understand the result. 👇
Ans is C) [‘x’, ‘y’, ‘z’] Explain: copy() function performs shallow copy which means after copying it i.e., value of b to d value refer to different memory location instead of location of variable b. So if we check the value of b it would be [‘x’, ‘y’, ‘z’]
[x,y,z]... No operation is done on b and hence the result will be untouched. Thanks.
The code ran without error but no out on the terminal
United States 趋势
- 1. Trey Yesavage 21.7K posts
- 2. #AEWDynamite 20.6K posts
- 3. JUNGWOO 69.2K posts
- 4. #LoveIsBlind 3,185 posts
- 5. Snell 12.4K posts
- 6. Pelicans 3,193 posts
- 7. #Survivor49 3,196 posts
- 8. Bulls 24.1K posts
- 9. Donovan Mitchell 5,285 posts
- 10. Anthony Davis 3,440 posts
- 11. Kacie 1,435 posts
- 12. Cavs 9,240 posts
- 13. Dwight Powell N/A
- 14. #ChicagoPD N/A
- 15. #SeeRed N/A
- 16. Willie Green N/A
- 17. Brandon Williams 1,063 posts
- 18. Dave Roberts 2,397 posts
- 19. Trae Young 3,083 posts
- 20. Game 5 59.2K posts
Something went wrong.
Something went wrong.