Skip to content
Advertisement

How to change one element in a sublist using list comprhension

I am worrying in python, and I’ve a list composed by 8 sublists, made in this way: [[value1,value2,value3], …].

I want to change to “False” only the third value (value3) in all sublists using a list comprhension, but my code does not work, and a I don’t know why.

JavaScript

athlete_session_el['top_bottom_first'] is the list of sublists.

Advertisement

Answer

The following works:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement