On Thu, Dec 23, 2021 at 05:53:46PM -, Stefan Pochmann wrote:
> Chris Angelico wrote:
> > If you're removing multiple, it's usually best to filter. This is a
> > great opportunity to learn about list comprehensions and the
> > difference between O(n) and O(n²) :)
> > ChrisA
>
> It would be O(n)
On 2021-12-25 23:52, Steven D'Aprano wrote:
On Thu, Dec 23, 2021 at 05:53:46PM -, Stefan Pochmann wrote:
Chris Angelico wrote:
> If you're removing multiple, it's usually best to filter. This is a
> great opportunity to learn about list comprehensions and the
> difference between O(n) and O(
On Sun, Dec 26, 2021 at 11:00 AM Steven D'Aprano wrote:
>
> On Thu, Dec 23, 2021 at 05:53:46PM -, Stefan Pochmann wrote:
> > Chris Angelico wrote:
> > > If you're removing multiple, it's usually best to filter. This is a
> > > great opportunity to learn about list comprehensions and the
> > >
Steven D'Aprano wrote:
> On Thu, Dec 23, 2021 at 05:53:46PM -, Stefan Pochmann wrote:
> > Chris Angelico wrote:
> > If you're removing multiple, it's usually best to filter. This is a
> > great opportunity to learn about list comprehensions and the
> > difference between O(n) and O(n²) :)
> > C
On Sun, Dec 26, 2021 at 11:32 AM Jeremiah Vivian
wrote:
>
> Steven D'Aprano wrote:
> > On Thu, Dec 23, 2021 at 05:53:46PM -, Stefan Pochmann wrote:
> > > Chris Angelico wrote:
> > > If you're removing multiple, it's usually best to filter. This is a
> > > great opportunity to learn about list
Chris Angelico wrote:
> On Sun, Dec 26, 2021 at 11:32 AM Jeremiah Vivian
> [email protected] wrote:
> > Steven D'Aprano wrote:
> > On Thu, Dec 23, 2021 at 05:53:46PM -, Stefan Pochmann wrote:
> > Chris Angelico wrote:
> > If you're removing multiple, it's usually best to filter. This
On Fri, Dec 24, 2021 at 10:22:29AM -, Stefan Pochmann wrote:
> Chris Angelico wrote:
> > Here's the equivalent as a list comprehension, which I think looks
> > better than either of the above:
> > [x + 1 for x in [1,2,3] if x % 2 == 0]
>
> That's not equivalent. You produce [3] instead of [2,