-2
I’m developing a python program that should receive a contact’s name and phone number and store in a calendar in alphabetical order. So far so good. The problem appears when I need to implement a search option (line 19), where the user informs the name of the contact he is looking for and the program returns the requested name and number.
Below this program, someone can help me implement this function?
Phonebook
agenda=[]
n_contato=int(input("Quantos contatos voce deseja salvar? "))
itens=1
def Agenda_Telefonica
for i in range(n_contato):
contato=[]
for j in range(itens):
nombre=input("Cual es el nombre del contato, mi amigx? ")
telefono=int(input("Cual es el telefono? "))
contato.append(nombre)
contato.append(telefono)
agenda.append(contato)
return agenda
agenda.sort() ### colocado em ordem alfabetica ###
print("Vossa agenda telefonica tienes ",len(agenda),"contatos salvos, sendo ellos",agenda)
index=agenda.index.contato.index(input("Estas a procurar el contato de quem? "))
print("El contatito que tu procuras es: ",agenda(index))
Reformat your question and code better, use the markdown syntax to post snippets of code in your question, this way people will be more able to help you.
– Ronald Rodrigues