Ibuprofeno.pyπŸ’Š| #130: Explica este cΓ³digo Python



This content originally appeared on DEV Community and was authored by Cristian Fernando

Explica este cΓ³digo Python

Dificultad: FΓ‘cil

x = {"a", "b", "c"}
print("c" in x)
  • A. True
  • B. False
  • C. NameError
  • D. SyntaxError

Respuesta:

👉 A. True

Podemos usar el operador in para verificar si un valor pertenece o no a un conjunto.

En nuestro ejemplo c si esta en el conjunto x, entonces regresamos True.


This content originally appeared on DEV Community and was authored by Cristian Fernando