This content originally appeared on DEV Community and was authored by Cristian Fernando
Explica este código Python
Dificultad: Fácil
x = {1, 2, 3}
x.add(10)
print(x)
-
A.
{10, 1, 2, 3}
-
B.
{1, 2, 3}
-
C.
{10}
-
D.
Ninguno de los anteriores
Respuesta:
👉 A. {10, 1, 2, 3}
Para agregar items a un conjunto se debe usar el método add()
.
Se verifica que el item a agregar no exista en el conjunto, si existe entonces no lo agrega.
This content originally appeared on DEV Community and was authored by Cristian Fernando
Cristian Fernando | Sciencx (2024-06-28T11:00:00+00:00) Ibuprofeno.py💊| #127: Explica este código Python. Retrieved from https://www.scien.cx/2024/06/28/ibuprofeno-py%f0%9f%92%8a-127-explica-este-codigo-python/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.