I am trying to find an element in a list, how can I do that? This is what I wrote:
user_list = [
{'name': 'Alizom_12',
'gender': 'f',
'age': 34,
'active_day': 170},
{'name': 'Xzt4f',
'gender': None,
'age': None,
'active_day': 1152},
{'name': 'TomZ',
'gender': 'm',
'age': 24,
'active_day': 15},
{'name': 'Zxd975',
'gender': None,
'age': 44,
'active_day': 752},
]
def find_user(user_name):
for items in user_list:
if user_name == 'name':
print(user_name+" exists")
else:
print(user_name+" does not exists")
when I print the following I want it to find the user:
find_user('Alizom_12')