Learn Python LIST COMPREHENSIONS in 10 minutes! 📃

Поділитися
Вставка
  • Опубліковано 18 січ 2025

КОМЕНТАРІ • 44

  • @BroCodez
    @BroCodez  7 місяців тому +11

    # List comprehension = A concise way to create lists in Python
    # Compact and easier to read than traditional loops
    # [expression for value in iterable if condition]
    doubles = [x * 2 for x in range(1, 11)]
    triples = [y * 3 for y in range(1, 11)]
    squares = [z * z for z in range(1, 11)]
    fruits = ["apple", "orange", "banana", "coconut"]
    uppercase_words = [fruit.upper() for fruit in fruits]
    fruit_chars = [fruit[0] for fruit in fruits]
    numbers = [1, -2, 3, -4, 5, -6, 8, -7]
    positive_numbers = [x for x in numbers if x >= 0]
    negative_numbers = [x for x in numbers if x < 0]
    even_numbers = [x for x in numbers if x % 2 == 0]
    odd_numbers = [x for x in numbers if x % 2 == 1]
    grades = [85, 42, 79, 90, 56, 61, 30]
    passing_grades = [grade for grade in grades if grade >= 60]

  • @BrunoVinicius-ix8wt
    @BrunoVinicius-ix8wt 4 місяці тому +5

    This is the best programming channel on UA-cam. Period.

  • @ma_astro
    @ma_astro 28 днів тому +1

    bro once again proves that he makes the best programming content out there

  • @oseaniic
    @oseaniic 5 місяців тому +4

    Like the 3rd video I watch about it, and I finally understood it 2 mins in, thanks a lot for being this great!

  • @Ctrl-Z-Renders
    @Ctrl-Z-Renders 7 місяців тому +3

    You are both a good teacher and a good person,
    i think that because you got 6000 usd for a good cause!

  • @kqndy_6349
    @kqndy_6349 Місяць тому

    best tutorial i had ever watched about list comprehensions

  • @SabonaMarara
    @SabonaMarara 7 місяців тому +7

    true teacher

  • @gianghoang4594
    @gianghoang4594 7 місяців тому +2

    Love your vids

  • @elijahsokoni7997
    @elijahsokoni7997 4 місяці тому +1

    Thanks mate. Brilliant tutorial

  • @ranjeetprasad4586
    @ranjeetprasad4586 7 місяців тому +12

    I am from India what a melodious voice u have

  • @InnnocentladSMCtradinghub
    @InnnocentladSMCtradinghub 7 місяців тому +2

    Sit back relax and enjoy

  • @technicalswag3925
    @technicalswag3925 7 місяців тому +2

    Sir please continue and complete the react course

  • @lucasbozdog5922
    @lucasbozdog5922 2 місяці тому

    great tutorial thank you

  • @ahmetunaldi7601
    @ahmetunaldi7601 2 місяці тому +1

    Bro is great....

  • @aj_the_cutiepatootie
    @aj_the_cutiepatootie 7 місяців тому +3

    Bro Code teaching me more in 10 minutes than my IT teacher teaching me the same material in 2 weeks😭

  • @xzex2609
    @xzex2609 7 місяців тому +1

    I wonder if bro making these videos, recently . cause after making React tutorials he wants to take some time off. if it is we are all happy that you back. and we hope to learn Next.js from you.

  • @JuanTheone11
    @JuanTheone11 5 місяців тому +1

    This dude is the definition of Gigachad

  • @samarthpawar181
    @samarthpawar181 15 днів тому

    Thanks

  • @tamalchakraborty5346
    @tamalchakraborty5346 3 місяці тому

    Thank the gods for the formula.

  • @JohnBrillianton
    @JohnBrillianton 7 місяців тому

    Thanks Bro

  • @jihane-x2z
    @jihane-x2z 7 місяців тому

    can u pls mmake a video about numpy arrays

  • @NinjaDude_YT
    @NinjaDude_YT 7 місяців тому

    When I try to run the script at 4:54, I keep getting this AttributeError and exit code 1. What happened?

    • @xzex2609
      @xzex2609 7 місяців тому

      you may confuse fruit (singular) with fruits (plural) if you get error , also you need to use () after fruit.upper()
      upper = [ fruit.upper() for fruit in fruits]

  • @alinegomes9084
    @alinegomes9084 7 місяців тому

    loved

  • @Norro_o
    @Norro_o 7 місяців тому

    pls make a video about explaining grid in css🙏🙏

  • @Halkdzdf
    @Halkdzdf 7 місяців тому +1

    W video as always

  • @Veryprogamer123
    @Veryprogamer123 7 місяців тому +1

    tutoiral on ALL of oop please

  • @exyoris4079
    @exyoris4079 7 місяців тому +1

    why is he redoing these python videos? he already had made a video on list comprehensions

    • @nickreffner4574
      @nickreffner4574 Місяць тому

      Maybe he wanted to expand or explain the concepts differently. Maybe he wanted to juice the algorithm for that sweet sweet ad revenue? Maybe my replying to this 6-month-old comment also boosts it? 👍👌

  • @wndos
    @wndos 7 місяців тому +3

    150 missed calls from coding schools

  • @facegrace_sk6584
    @facegrace_sk6584 2 місяці тому

    Great video, watch it. (like and comment so more people find this video)

  • @afinotantemisan8622
    @afinotantemisan8622 Місяць тому

    You should’ve included “else”

  • @titangamer7906
    @titangamer7906 5 місяців тому

    I can just say you are smarter than chat gpt !

  • @Veryprogamer123
    @Veryprogamer123 7 місяців тому +1

    third!

  • @tamalchakraborty5346
    @tamalchakraborty5346 3 місяці тому

    How do the fit 2 in the list of odd numbers with List comprehension?