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 🎉
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.
C. Because b doesn't point to the data that d points
The code ran without error but no out on the terminal
United States Xu hướng
- 1. #UFC321 81.4K posts
- 2. Mateer 5,101 posts
- 3. $SWC 2,562 posts
- 4. Ole Miss 12.5K posts
- 5. Liverpool 99.1K posts
- 6. Almeida 58.9K posts
- 7. Dern 55.1K posts
- 8. Arbuckle 2,715 posts
- 9. Lane Kiffin 6,118 posts
- 10. Oklahoma 17.2K posts
- 11. Volkov 51.5K posts
- 12. Umar 25.2K posts
- 13. Brentford 41.6K posts
- 14. June Lockhart 1,740 posts
- 15. UCLA 8,105 posts
- 16. Kerkez 15.6K posts
- 17. Hugh 13.8K posts
- 18. Arkansas 20.6K posts
- 19. Aaron Henry N/A
- 20. Memphis 14.2K posts
Something went wrong.
Something went wrong.