Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Add missing names
#python 3.5.2 # List of strings my_list = ['john', 'james', 'joey'] # List of dictionaries results = [{"name": 'john', "age": 20}, {"name": 'james', "age": 25}] unique_names = set((person["name"] for person in results)); for name in my_list: if name not in unique_names: new_person = { 'name': name, 'age': 30 } results.append(new_person); print(results)
run
|
edit
|
history
|
help
0
PyRef
My name
Iam hungry
Bmi calculator dictionary
python_study_note_while loop
Faiha Lesson 3
PyCutRod(BotUp)
bubbleSort.py
on_off
Code hello world