QuestenaPractice that shows what to review next
Question 17

After `a = "sun"` and `b = a + "set"`, which statement is correct?

  1. `b` is `sunset`, while `a` remains `sun`.Correct answer
  2. Both `a` and `b` become `sunset`.
  3. The operation performs numeric addition after conversion.
  4. The operation raises TypeError because strings cannot use plus.

Explanation

String addition creates the new value `sunset` and binds it to `b`; the immutable object referred to by `a` remains `sun`. The idea that the left operand grows in place would require mutable string contents, which Python does not provide.

Continue with this test

Start practice
Question 17: After `a = "sun"` and `b = a + "set"`, which statement is… · Python Fundamentals · Questena