Skip to content

Commit 777ee58

Browse files
committed
complex_delete
1 parent a8c240c commit 777ee58

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/python3
2+
3+
def complex_delete(a_dictionary, value):
4+
listOfKey = list(a_dictionary.keys())
5+
6+
for x in listOfKey:
7+
if value == a_dictionary.get(x):
8+
del a_dictionary[x]
9+
10+
return a_dictionary
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/python3
2+
complex_delete = __import__('102-complex_delete').complex_delete
3+
print_sorted_dictionary = \
4+
__import__('6-print_sorted_dictionary').print_sorted_dictionary
5+
6+
a_dictionary = {'lang': "C", 'track': "Low", 'pref': "C", 'ids': [1, 2, 3]}
7+
new_dict = complex_delete(a_dictionary, 'C')
8+
print_sorted_dictionary(a_dictionary)
9+
print("--")
10+
print_sorted_dictionary(new_dict)
11+
12+
print("--")
13+
print("--")
14+
new_dict = complex_delete(a_dictionary, 'c_is_fun')
15+
print_sorted_dictionary(a_dictionary)
16+
print("--")
17+
print_sorted_dictionary(new_dict)
Binary file not shown.

0 commit comments

Comments
 (0)