QuestenaPractice that shows what to review next
Question 20

A program runs `text = "LOUD"` and then `quiet = text.lower()`. What happens?

  1. Both names refer to `loud` after an in-place change.
  2. `quiet` is `None`, and `text` becomes `loud`.
  3. Calling `lower` raises TypeError on immutable text.
  4. `quiet` is `loud`, and `text` remains `LOUD`.Correct answer

Explanation

The method creates the lowercase string for `quiet` while the original immutable string stays unchanged under `text`. Expecting an in-place edit mistakes the returned string for a mutation of the receiver.

Continue with this test

Start practice
Question 20: A program runs `text = "LOUD"` and then `quiet =… · Python Fundamentals · Questena