In: Computer Science
in Python 3, I need to search a dictionary for the matching key while ignoring case of the string and the key. then print the dictionary item in it's original case.
here is the code I have so far but the compiler isn't liking that the name string is lowercase
```
dictionary = {"Dan Smith": {"street":"285 Andover Lane",
"city":"Pompano Beach", "state":"FL", "zip":"33060"},"Parker
Brady": {"street":"7416 Monroe Ave.", "city":"Windsor",
"state":"CT", "zip":"07302"}}
name ="dan smith"
line= dict(filter(lambda item: name.lower() in item[0], dictionary.items()))
print("Street:%5s "% line[name]['street'])
print("City:%5s" % line[name]['city'])
print("State:%5s "% line[name]['state'])
print("Zip Code:%5s "% line[name]['zip'])
```
output should be
Street: 285 Andover Lane
City: Pompano Beach
State: FL
Zip Code: 33060
code:
output :
raw_coode :
#given data
dictionary = {"Dan Smith": {"street":"285 Andover Lane",
"city":"Pompano Beach", "state":"FL",
"zip":"33060"},
"Parker Brady": {"street":"7416 Monroe Ave.",
"city":"Windsor", "state":"CT",
"zip":"07302"}}
name ="dan smith"
#using comprehension for changing to lower case
line = {i.lower(): j for i,j in dictionary.items()}
#displaying required details
print("Street: %5s"%line[name]['street'])
print("City:%5s" % line[name]['city'])
print("State:%5s "% line[name]['state'])
print("Zip Code:%5s "% line[name]['zip'])
**do comment for queries and rate me up****