I want to create a function that can be use to delete the non comon elements( I should delete Audi an Mercedes of two lists) :
marcas = [
(1, 'Audi'),
(2, 'Nissan'),
(3, 'Mercedes'),]
marcas2 = []
coches = [
{
'modelo': 'Audi C3',
'marca': 1,
'precio': 25000,
'ano': 2017,
}]
def delbrand(marcas):
for y in coches:
for x in marcas:
if y['marca'] == x[0]:
if x not in marcas2:
marcas2.append(x)
m = 0
for i in marcas:
if i not in marcas2:
del marcaslist[m]
m = m+1
would you mind to help me with this question?