QuestenaPráctica que te muestra qué repasar después
Pregunta 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`.Respuesta correcta

Explicación

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.

Continúa con este test

Empezar la práctica
Pregunta 20: A program runs `text = "LOUD"` and then `quiet =… · Python Fundamentals · Questena