How to access Tuples value
Im taking a Sololearn Practice, and Im stumped by this question: -------------------------------------------------- You are given a list of contacts, where each contact is represented by a tuple, with the name and age of the contact. Complete the program to get a string as input, search for the name in the list of contacts and output the age of the contact in the format presented below: Sample Input John Sample Output John is 31 ::If the contact is not found, the program should output "Not Found". ------------------------------------------------------------------ I tried it by doing the code below, but when I run it it always say "Not found:" contacts = [ ('James', 42), ('Amy', 24), ('John', 31), ('Amanda', 63), ('Bob', 18) ] cont = dict(contacts) name = input() if name in contacts: print (name + "is" + cont.get(name)) else: print ("Not Found") ----------------------------- I've seen others answer on this app but they look so complicated, and as a newbie I thought I could write it in a code I understand. However, Im stumped. Please tell me what Im doing wrong. And if there's other ways to make the code work without changing it too much.