How Can I implement The 'search' Feature?
Hi, I am relatively new to coding and decided to make a telephone directory to practice making and using dictionaries. I have implemented all my desired functions in it but I can't add the 'search for a name'in LINE 48 feature somehow. I have tried it many times with .get() methods and making many variables but it doesn't work. Basically, how it works is, you search for a name and it shows you the person's phone number from the directory. Any help on this feature or suggestions for improving my code would be appreciated.
Thanks CoolJames1610!!! I tried to implement your suggestion, but unfortunately there was some kind of error. But it also gave me another idea, to make a function that looks through the dictionary.
So, I made a new function.
search_split = search_input.split(" ")
search_output = ""
for name in search_split:
search_output += directory.get(name, name)