Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created May 23, 2022 01:51
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save parzibyte/31576690107b2859449a0fda2b712adc to your computer and use it in GitHub Desktop.
def obtener_agenda():
contactos = {}
while True:
nombre = input(
"Ingrese un nombre o déjelo vacío para terminar de agregar: ")
if nombre == "":
break
if nombre in contactos:
print("Nombre ya existente")
else:
telefono = input(f"Ingrese el teléfono de {nombre}: ")
contactos[nombre] = telefono
return contactos
def imprimir_agenda():
contactos = obtener_agenda()
for nombre in contactos:
telefono = contactos[nombre]
print(f"{nombre} tiene el teléfono {telefono}")
def main():
imprimir_agenda()
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment