Hello, I am writing because I have a question.
In a situation where a list of items is made in a dictionary like this
What should I do if I only try to print out people who are over a certain age?
For now, for I test1.values(): I thought about it.
After that, I can't print out the age of 25 or older on the if conditions.
test1= { list1' : [ {'name' : TVXQ', 'age' : 24}, {'name' : Yoo Jae-seok, 'age' : 34}, {'name' : 'IU', 'age' : 37}, ], list2 : [ {'name' : 'Kim Jinwoo', 'age' : 24}, {'name' : spring water', 'age' : 20}, {'name' : 'Jingu', 'age' : 25},
python
for i in test1.values():
for ii in i:
if ii['age'] > 24:
print(ii)
© 2024 OneMinuteCode. All rights reserved.