I have the following list of lists:
list1 = [[1,"one"],[2,"two"],[3,"three]]
I would like to have output of:
list2 = [[11,"one"],[2,"two"],[3,"three"]]
List comprehension with an if-else statement seems to be a good option for this.
list2 = [x if x[0] != 1 else 11 for x[0] in list1]
However, I get the NameError that 'x' is not defined. How should I define x?