0

How do you solve the code practice of tuples in python intermediaire

I am à beginners in python. In the code practice we need to create à program for searching name and âgé of the name input. We are supposed to output the name + is+ age only if it is found and Not found else. But as it is a list of tuples the for loop print not found before printing the right output. Even with the solution the same result are found. Now i am blocked on this code practice. Please help me.

10th Sep 2022, 7:23 AM
Camélia Morning'star
Camélia Morning'star - avatar
2 odpowiedzi
+ 4
Hi! Please, show your code attempt.
10th Sep 2022, 7:37 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
Since we can't see your attempt, I'm not 100% sure what the problem might be, but I just revisited the practice question, and it's possible you might have an iteration issue. Since this is a list of tuples and not a dictionary, you have to iterate through the items in the list and see if what you're looking for is in them, not just in the list. Hope this makes sense.
10th Sep 2022, 11:41 AM
Tyler McKechnie