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 Tendenze
- 1. Carson Beck 3,483 posts
- 2. Vandy 12.4K posts
- 3. Miami 61.6K posts
- 4. Clemson 11.7K posts
- 5. Mario 64.8K posts
- 6. Jeremiah Smith 8,660 posts
- 7. Texas 117K posts
- 8. Ohio State 17.3K posts
- 9. Jeff Sims 1,162 posts
- 10. Vanderbilt 9,948 posts
- 11. Dawson 4,646 posts
- 12. #UFCVegas110 3,417 posts
- 13. Julian Sayin 6,743 posts
- 14. Dabo 2,801 posts
- 15. Pavia 4,501 posts
- 16. #HookEm 4,233 posts
- 17. Duke 20.1K posts
- 18. Caicedo 48.9K posts
- 19. Caleb Downs 1,438 posts
- 20. #iufb 1,184 posts
Something went wrong.
Something went wrong.