I'm trying to delete all occurrences of elements of C in the dictionary v1.
e.g. in the example below, C = ['L']
and I'm trying to remove L from all the dictionary values (which are lists). I've been working on the code below:
v1 = {'D': ['J', 'K', 'L'], 'B': ['K', 'J', 'L'], 'C': ['L', 'J', 'K'], 'E': ['K', 'L', 'J'], 'A': ['J', 'L', 'K']}
c = ['L']
for q,v in v1.items():
for i in v1.items():
if c[i] == v[0]:
del v[0]
However this has been giving me all sorts of errors: index errors because I'm deleting v[0] and it's iterating over and I'm not sure how to fix this?