Solve please..... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Solve please.....

Tuple 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". Code: contacts = [ ("John", 23), ("Arif",34), ("Ajay",46), ("Max",19) ]

12th Sep 2023, 2:27 PM
Musharaf Nazir
Musharaf Nazir - avatar
3 Answers
+ 1
YOU are to solve the task. If you need help with your code, link your code attempt. Hint: Get input. Use a loop to iterate the contacts. Use an if-statement to check whether the input name is in contacts.
12th Sep 2023, 3:02 PM
Lisa
Lisa - avatar
0
Thanks
12th Sep 2023, 3:03 PM
Musharaf Nazir
Musharaf Nazir - avatar
0
Lisa thanks
12th Sep 2023, 3:05 PM
Musharaf Nazir
Musharaf Nazir - avatar