DEV Community

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

Posted on • Edited on

1

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

Explica este código Python

Dificultad: Fácil

## Reto #64
my_dict = {"name": "John", "age": 30, "city": "New York"}
del my_dict["age"]
print(my_dict)
Enter fullscreen mode Exit fullscreen mode

👉 A. {'name': 'John', 'city': 'New York'}
👉 B. {"name": "John", "age": 30, "city": "New York"}
👉 C. SyntaxError
👉 D. TypeError


Respuesta en el primer comentario.

Top comments (1)

Collapse
 
duxtech profile image
Cristian Fernando • Edited

Respuesta:
👉 A. {'name': 'John', 'city': 'New York'}

Una manera de poder eliminar pares clave-valor de un diccionario es usando el operador del. Su sintaxis es muy sencilla de usar e intuitiva de entender.

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay