DEV Community

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

Posted on

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

Explica este código Python

Dificultad: Intermedio

a = [10]
b = [10]
print(a is b)
print(a == b)
Enter fullscreen mode Exit fullscreen mode
  • A. True, False
  • B. False, True
  • C. True, True
  • D. False, False

Respuesta:

👉 B. False, True

Creamos dos listas diferentes con valores iguales y las comparamos.

Primero usamos el operador is que realiza una verificación por identidad, lo que significa que comprobamos si ambas listas estan almacenadas en la misma dicción de memoria, esto es falso.

Luego usamos el operador == que compara las listas por valor, comprueba si el contenido de ambas listas es el mismo, esto es verdadero.

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay