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 ํธ๋ ๋
- 1. Cowboys 35.9K posts
- 2. Steelers 29.4K posts
- 3. Broncos 35.6K posts
- 4. Jonathan Taylor 10.5K posts
- 5. Brian Kelly 41.4K posts
- 6. Jets 94.7K posts
- 7. #GoPackGo 3,555 posts
- 8. Bengals 55.2K posts
- 9. Bo Nix 7,175 posts
- 10. Joe Milton 1,215 posts
- 11. Bucs 10.3K posts
- 12. #HereWeGo 2,985 posts
- 13. Eberflus 2,840 posts
- 14. Riley Moss 1,421 posts
- 15. #ForTheShoe 2,149 posts
- 16. Zeus 14.3K posts
- 17. Saints 30.9K posts
- 18. Caleb 39.2K posts
- 19. Shough 3,704 posts
- 20. Jerry Jones 1,487 posts
Something went wrong.
Something went wrong.