[Tutor] Fwd: Re: Replace nth item with single value in each nested list
Alex Kleider
akleider at sonic.net
Thu May 14 23:43:43 EDT 2020
Inadvertently hit Reply instead of Reply-All; Sorry.
-------- Original Message --------
Subject: Re: [Tutor] Replace nth item with single value in each nested
list
Date: 2020-05-14 20:42
From: Alex Kleider <akleider at sonic.net>
To: EK Esawi <ekesawi at yahoo.com>
On 2020-05-14 15:01, EK Esawi via Tutor wrote:
> Hi All
>
> Thank you Narasimharao and Alan for the help. The reason i want to
> use list comprehension is because I used it through my project and I
> just like it because it’s concise and short. Lastly, I find it
> amusing and disappointing that some people seem to make judgment
> without any proof about a posting as whether the question asked is a
> homework or not-very disappointing indeed.
I suggest you not express to much disappointment in/to people who are
trying to help you.
As to your desire to use list comprehension:
I found your wish to do it this way intriguing but couldn't make it work
until I did a little research and found the answer here:
https://stackoverflow.com/questions/4260280/if-else-in-a-list-comprehension
More information about the Tutor
mailing list