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.
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 الاتجاهات
- 1. Austin Reaves 45.2K posts
- 2. Steelers 85.1K posts
- 3. Tomlin 12.5K posts
- 4. Packers 66.8K posts
- 5. Jordan Love 16.9K posts
- 6. Derry 20.2K posts
- 7. Tucker Kraft 15.6K posts
- 8. #GoPackGo 10.7K posts
- 9. #breachlan2 3,069 posts
- 10. #BaddiesAfricaReunion 9,965 posts
- 11. Zayne 21K posts
- 12. Pretty P 4,093 posts
- 13. #LakeShow 3,768 posts
- 14. Dolly 12.5K posts
- 15. #LaGranjaVIP 71.6K posts
- 16. Aaron Rodgers 19.9K posts
- 17. Teryl Austin 2,180 posts
- 18. yixing 11.2K posts
- 19. Sabonis 2,526 posts
- 20. Karola 4,235 posts
Something went wrong.
Something went wrong.