0

Can anyone please help me with solving this code in Python. I tried a lot but it's not going well.

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 contacts = [ ('James', 42), ('Amy', 24), ('John', 31), ('Amanda', 63), ('Bob', 18) ]

20th Nov 2021, 1:44 PM
Kaleab
2 ответов
+ 1
Kaleab Can we show your tried?
20th Nov 2021, 1:50 PM
A͢J
A͢J - avatar
0
I already get it! Thank You!! name = input() for i in contacts: if name in i: print(f'{i[0]} is {i[1]}') break else: continue print("Not found")
20th Nov 2021, 2:28 PM
Kaleab