Python tutorial - List comprehensions with Multiple 'Ifs' Explained (Conditionals and Filtering)

Поділитися
Вставка
  • Опубліковано 24 гру 2024

КОМЕНТАРІ • 40

  • @drivers99
    @drivers99 Рік тому +1

    The last three list comprehension videos of yours I just watched makes it really clear. For some reason, in the past, list comprehensions seemed so random, but not anymore!

  • @mackymichel8052
    @mackymichel8052 Рік тому +2

    That is the real Best Ultimate Guide to Python LC

  • @AbhinavKumar-dr4ef
    @AbhinavKumar-dr4ef 3 роки тому +6

    I was literally searching for this. Awesome work in a simple way you have explained I am new to Python was stuck with this. Thank you

  • @ingluissantana
    @ingluissantana 3 роки тому +1

    great explanation!

  • @josiahdavid7735
    @josiahdavid7735 3 роки тому +2

    Thanks very much for this video series man!!

  • @norbertnagy5325
    @norbertnagy5325 10 місяців тому +1

    Great job thank you!

  • @feroztech88
    @feroztech88 Рік тому +1

    Thank you very much

  • @danyar25
    @danyar25 Рік тому +1

    How about print((i, f), end=“, “)? This way you might get similar outputs.

  • @TheLKStar
    @TheLKStar Рік тому

    The reason the outputs aren't the same at 7:20 is because the first one is a list, the second one is just printing the individual results inside the nested for.

  • @MrNess2911
    @MrNess2911 9 місяців тому +1

    I never thought I could find something like this. I'm amazed!😃

  • @IntricateMoon
    @IntricateMoon Рік тому

    THANK YOU FOR THIS BRENDAN!! 😇

  • @vishaljuneja1206
    @vishaljuneja1206 3 роки тому +2

    which terminal you using and how are you able to get auto completion in it ?

    • @BrendanMetcalfe
      @BrendanMetcalfe  3 роки тому +1

      Normal mac terminal, or iterm2, with bpython

    • @vishaljuneja1206
      @vishaljuneja1206 3 роки тому

      @@BrendanMetcalfe Oh thats why you had auto completion and color scheme in python shell. Thanks I didn't know that

    • @BrendanMetcalfe
      @BrendanMetcalfe  3 роки тому +1

      @@vishaljuneja1206 Yeah bpython is cool

  • @feroztech88
    @feroztech88 Рік тому +1

    Great Job

  • @sagarajayathilaka
    @sagarajayathilaka 11 місяців тому +1

    Great Stuff 💯

  • @rishabhkaul5556
    @rishabhkaul5556 2 роки тому +1

    @Brendan Metcalfe You are by far the best I have watched in terms of explanation and breaking down each problem statement . Simply amazing !!
    I have messaged you on linkedin as well. Please come out with a playlist on the below topics . It will be super helpful- :
    1) Numpy , python libraries
    2) Pandas
    3) Regular Expressions
    4) OOP concepts

  • @allanimeworld2898
    @allanimeworld2898 3 роки тому +1

    Sir can you please tell me which side was just you visiting in starting where you show us info of list comprehension

    • @MohaDou
      @MohaDou 3 роки тому +1

      python.org/dev/peps/pep-0202/

    • @MohaDou
      @MohaDou 3 роки тому +1

      python.org/dev/peps/pep-0202/

    • @allanimeworld2898
      @allanimeworld2898 3 роки тому +1

      Thanks to you very much

  • @ElowenFaye
    @ElowenFaye 3 роки тому +1

    Hey Brendan, thank you for the video! I tried to solve a problem with it but I'm still stuck (for 4 hours straight) ... May I ask you for advice?
    I have a dataframe with several columns. I now want to create a new columns that contains a string ("yes") if 1.) one of the columns (column name: condition) contains a certain string-value ("pictures") and 2.) the float-value of another colums (column name: rt for reaction time) is > 0.5. And if the first column ("condition") contains the same string-value ("pictures") but the other column has a float-value 0.5 else "no" for i in df.rt] --> but this only contains the condition referring to the reaction time (rt) > or

  • @ricardodiaz8964
    @ricardodiaz8964 2 роки тому

    great video, where can I find your code?

  • @andynelson2340
    @andynelson2340 3 роки тому +1

    Awesome, thanks.

  • @manfrombritain6816
    @manfrombritain6816 Рік тому +1

    what i'm getting so far is that "list comprehensions = squashing for loops into 1 line so they are less readable"

  • @KrazyMO
    @KrazyMO 2 роки тому +1

    I was hoping you were going to include adding unique list items so you would only have one entry per fruit with the number of summed. I don’t know if that can be done in the list comprehension or not.

    • @BrendanMetcalfe
      @BrendanMetcalfe  2 роки тому +1

      My first thought is to use the set() built in function somewhere to ensure only unique items.

  • @jell._.y
    @jell._.y 8 місяців тому +1

    Cool

  • @JVenom_
    @JVenom_ Рік тому

    ahh so its basically creating new sub nested parts when adding an item to the right