Challenge: Phonebook Application
Aufgabe
Swipe to start coding
Create a simple phonebook application using a dictionary to manage contacts. Implement three functions: one to add contacts, one to search for a contact by name, and one to delete a contact by name.
- Add a contact by setting the provided name as the key and the number as the value in the dictionary.
- Search for a contact by name and return the associated number if found, or the string
"Contact not found"if the name does not exist in the dictionary. - Delete a contact by name and return
trueif the contact was deleted, orfalseif the name was not found in the dictionary.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 2. Kapitel 3
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Großartig!
Completion Rate verbessert auf 4.76
Challenge: Phonebook Application
Swipe um das Menü anzuzeigen
Aufgabe
Swipe to start coding
Create a simple phonebook application using a dictionary to manage contacts. Implement three functions: one to add contacts, one to search for a contact by name, and one to delete a contact by name.
- Add a contact by setting the provided name as the key and the number as the value in the dictionary.
- Search for a contact by name and return the associated number if found, or the string
"Contact not found"if the name does not exist in the dictionary. - Delete a contact by name and return
trueif the contact was deleted, orfalseif the name was not found in the dictionary.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 2. Kapitel 3
single