LearnFrenzy
Sign in Take a free test

Variables and Data Types · Variables and Data Types MCQ · Question 11

Does b = a copy a list? Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 11 Back to Exercise

After a = [1, 2] and b = a, which statement is true?

  • A b is a new copy of the list
  • B a and b refer to the same list object Correct
  • C b is a tuple
  • D a is now empty
Correct Answer: Option B

Assignment only binds another name. Use a.copy(), list(a) or a[:] for a new list.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links