99% do it wrong in Python

Sdílet
Vložit
  • čas přidán 21. 08. 2024
  • 99% do it wrong in Python (How to Remove Duplicates From A List in Python)

Komentáře • 8

  • @Koolac
    @Koolac  Před měsícem +5

    ================================
    NOTE:
    NOTE:
    NOTE:
    ================================
    Because I know that if I don't mention this, some people comment and say some stuff, I want to say it in advance:
    Using "set" is not wrong per se. But if you want to preserve the order, it's very obvious that "set" doesn't do so. So you should use another method. And I've said this explicitly in the video.
    Thanks for watching the video and reading this comment.
    See you in the next video.

  • @michaelmcgee7683
    @michaelmcgee7683 Před měsícem +1

    caveat: Python 3.7 or later for those still stuck in 2017 or earlier

  • @mtrisi
    @mtrisi Před měsícem +1

    list(sorted(list(set(x))))

    • @Koolac
      @Koolac  Před měsícem +1

      But it's wrong!
      Because I said in the video that we want to keep the original order (And NOT sorting!)

  • @alieslami3646
    @alieslami3646 Před měsícem +1

    👏👏