[Tutor] Replace nth item with single value in each nested list

EK Esawi ekesawi at yahoo.com
Thu May 14 05:16:32 EDT 2020


Hi All--

i have a nested list like this a=[[1,2],[4,5],[7,8]]. i want to replace the second element in each nested list with a specific value
i want something like this [[1,11],[4,11],]7,11]. I tried several things but nothing worked.
I am hoping for a list comprehension solution

Thanks--EK


More information about the Tutor mailing list