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
Add missing names
inverse matrix gauss jordan
Game3
5
1
PyOCP
π―π―π―π―π―π―π―π½Guess the number π½π―π―π―π―π―π―π―
class objects
Basic_if_else.py
lesson3 part3