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 Trends
- 1. Jets 105K posts
- 2. Sauce 77.2K posts
- 3. Sauce 77.2K posts
- 4. Breece Hall 8,437 posts
- 5. Garrett Wilson 4,454 posts
- 6. $JFB 2,692 posts
- 7. Cheney 216K posts
- 8. AD Mitchell 6,074 posts
- 9. Courtois 8,788 posts
- 10. Shaheed 15.6K posts
- 11. Mazi Smith 4,490 posts
- 12. Jerry 54.4K posts
- 13. Jermaine Johnson 2,889 posts
- 14. Merino 30K posts
- 15. #JetUp 1,516 posts
- 16. Indy 16.9K posts
- 17. #NFLtradedeadline N/A
- 18. Aaron Glenn N/A
- 19. Minkah 5,300 posts
- 20. Veach 4,143 posts
Something went wrong.
Something went wrong.