dict.get to pull list item from dict value
Hello! I'm trying to write a dict.get statement that will pull a single element from a dict value that is in the form of a list. If the value were a broken out list, I'd be trying to get list[1] but as an element of a list inside a dict value, I have no idea how to access it with dict.get. This is where I've gotten so far with it: sampleDict = { "name0" : ["phone0", "email0"], "name1" : ["phone1", "email1"], "name2" : ["phone2", "email2"], "name3" : ["phone3", "email3"]} searchQuery = input() print(sampleDict.get(searchQuery, "Not found")) This doesn't return any errors, but it gives the entire list within the value, which isn't what I'm after. I only want the email address. This is what I wrote to solve the exercise and keep going. It works, but it isn't what the lesson really wants to teach. sampleDict = { "name0" : ["phone0", "email0"], "name1" : ["phone1", "email1"], "name2" : ["phone2", "email2"], "name3" : ["phone3", "email3"]} searchQuery = input() if searchQuery in sampleDict: print(sampleDict[searchQuery][1]) else: print("Not found") I don't want to keep using if/else blocks to bypass new material, so I have to figure out the proper syntax for the dict.get statement in this case. I'm puzzled why the syntax that worked in the print statement, didn't work using dict.get.