I'm trying to remove all the negative signs before index[2]
in premier_league
:
My code:
premier_league = [
['A1','Manchester City', '-1', 'Aguero'],
['A2','Manchester City', '-11,2', 'Mahrez'],
['A3','Manchester City', '-13,5', 'Sterling'],
['B1','Liverpool', '-,5', 'Mane'],
['B2','Liverpool', '-5,6', 'Salah'],
['B3','Liverpool', '-7,2', 'Jota']]
for l in premier_league:
del l[-2][0]
Current output:
TypeError: 'str' object doesn't support item deletion
Desired output:
premier_league = [
['A1','Manchester City', '1', 'Aguero'],
['A2','Manchester City', '11,2', 'Mahrez'],
['A3','Manchester City', '13,5', 'Sterling'],
['B1','Liverpool', ',5', 'Mane'],
['B2','Liverpool', '5,6', 'Salah'],
['B3','Liverpool', '7,2', 'Jota']]