DEV Community

Cover image for Ibuprofeno.py💊| #159: Explica este código Python
Cristian Fernando
Cristian Fernando

Posted on

Ibuprofeno.py💊| #159: Explica este código Python

Explica este código Python

Dificultad: Fácil

x = ['1']
x.extend('234')
print(x)
Enter fullscreen mode Exit fullscreen mode
  • A. ["1", "234"]
  • B. ["1234"]
  • C. ["1", "2", "3", "4"]
  • D. Error

Respuesta:

👉 C. ["1", "2", "3", "4"]

El método extend() se caracteriza por iterar sobre cada carácter que le pasemos como parámetro.

Al tener x.extend('234') tendremos como items separados a 2, 3 y 4 y luego los agrega a la lista x.

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more