Python lambda λ

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024
  • Python lambda function expression tutorial example explained
    #python #lambda #function
    lambda function = function written in 1 line using lambda keyword
    accepts any number of arguments, but only has one expression.
    (think of it as a shortcut)
    (useful if needed for a short period of time, throw-away)
    # lambda parameters:expression
    double = lambda x: x * 2
    print(double(1))
    multiply = lambda x, y: x * y
    print(multiply(1,2))
    add = lambda x, y, z: x + y + z
    print(add(1,2,3))
    full_name = lambda first_name, last_name: first_name+" "+last_name
    print(full_name("Bro","Code"))
    Bro Code merch store 👟 :
    ===========================================================
    teespring.com/...
    ===========================================================
    music credits 🎼 :
    ===========================================================
    Up In My Jam (All Of A Sudden) by - Kubbi / kubbi
    Creative Commons - Attribution-ShareAlike 3.0 Unported- CC BY-SA 3.0
    Free Download / Stream: bit.ly/2JnDfCE
    Music promoted by Audio Library • Up In My Jam (All Of A...
    ===========================================================

Комментарии • 130

  • @BroCodez
    @BroCodez  3 года назад +36

    # lambda function = function written in 1 line using lambda keyword
    # accepts any number of arguments, but only has one expression.
    # (think of it as a shortcut)
    # (useful if needed for a short period of time, throw-away)
    #
    # lambda parameters:expression
    double = lambda x: x * 2
    print(double(1))
    multiply = lambda x, y: x * y
    print(multiply(1,2))
    add = lambda x, y, z: x + y + z
    print(add(1,2,3))
    full_name = lambda first_name, last_name: first_name+" "+last_name
    print(full_name("Bro","Code"))
    age_check = lambda age: True if age >= 18 else False
    print(age_check(18))

  • @Amir_Plays_non_stop
    @Amir_Plays_non_stop 3 года назад +45

    man, I am tired of commenting, but I have to keep going cuz u deserve it!

  • @raedrnp1098
    @raedrnp1098 Год назад +16

    My programming skills are growing faster since I met your channel. You're awesome!

  • @p99chan99
    @p99chan99 11 месяцев назад +5

    You can call the lambda function in the line itself you made it
    print((lambda x: x*2)(5))
    you can also use lists for the parameter as well.

  • @split6162
    @split6162 2 года назад +8

    Thanks man, I was so confused as to what lambda functions were in a course I was taking, this cleared it up!

  • @markost.8944
    @markost.8944 2 месяца назад

    Man, you really got a great talent to explain things in most simplistic way.
    Love your videos.

  • @herryhan6099
    @herryhan6099 3 месяца назад

    I used to struggled in Python but now I understand clearly because of your video. Keep up the good work

  • @mohammadnoori9278
    @mohammadnoori9278 Год назад +3

    Great as always, concise and precise 👌
    Straight to the point with all the important points needs to be passed on, perfecr 👍
    I've watched a lot of you tutorials and it's perfect 👍

  • @mehedihasaniqbal7633
    @mehedihasaniqbal7633 3 месяца назад

    Your teaching skill is really awesome. Thanks for the step step explanation. My programming knowledge is also growing fast to watch your videos.

  • @x0x080
    @x0x080 4 месяца назад +1

    you save my time to understand this lambda function. bro code you're amazing.

  • @Sigmaidka779
    @Sigmaidka779 6 месяцев назад +2

    Rise and shine mr freeman

  • @dj_arimakousei
    @dj_arimakousei 3 месяца назад

    so precious !!! thank you so much for sharing!!

  • @codewithraiju1424
    @codewithraiju1424 3 года назад +5

    Amazing Video Sir😄!.. Sir if sometime you think that you are absolutely free.. Then please upload a tutorial about filechooser in java.. And also the method of reading text files and writing it into the JTextArea...
    Thank You!

    • @BroCodez
      @BroCodez  3 года назад

      I think this might be what you're looking for:
      ruclips.net/video/A6sA9KItwpY/видео.html&ab_channel=BroCode

    • @codewithraiju1424
      @codewithraiju1424 3 года назад

      @@BroCodez thanx sir you are awesome

  • @ievgendergausov2867
    @ievgendergausov2867 Месяц назад

    Really like when u write with underscore much readable

  • @abduvaliabdumuratov_05
    @abduvaliabdumuratov_05 5 месяцев назад +1

    Incredible

  • @NageenaMd-mf3we
    @NageenaMd-mf3we 2 месяца назад

    very helpful,thankuu

  • @berryberry8290
    @berryberry8290 5 месяцев назад

    bro code is such a good name for this channel lol

  • @skyisthelimpet
    @skyisthelimpet Год назад +1

    Quick and informative. Thanks bro

  • @eazyo8393
    @eazyo8393 2 года назад +1

    Thanks 👍😊 Bro. Explanations are always easy to understand

  • @TechInFunWay
    @TechInFunWay Год назад

    thank you brooh that's my first time see your channel and you help a lot

  • @ShuaibShahzan
    @ShuaibShahzan 5 месяцев назад

    Love the way explain Bro ❤

  • @s.predator536
    @s.predator536 Год назад +1

    Nize chanel

  • @The_Black_7
    @The_Black_7 Год назад

    the best explanation I've seen so far, I liked the video and subscribe directly

  • @64_three
    @64_three 3 месяца назад +1

    Half life was so awesome, they made the lambda symbol a real thing!

  • @hisgraceiseonughforall-
    @hisgraceiseonughforall- 15 дней назад

    You are awesome bro💪

  • @Compuscience-Python-Prog-Exps
    @Compuscience-Python-Prog-Exps 7 месяцев назад

    Does that mean, they only work once throughout the program execution/run?
    Like, say I wanted to use it over and over again. Can I do that?
    Great Work as well as always..

  • @amanda-janedeagrella5020
    @amanda-janedeagrella5020 Год назад +1

    When you say throw away do you mean the function lambda is not used for another part of the code? And why use a long function when lambda is so short and easy to use? Why not use lambda all over and leave longer functions?Sorry very new to all this … love all your explanations 🙏🏼

    • @asserhalim2640
      @asserhalim2640 Год назад +2

      You can only use lambdas for a function that executes only one line of code. Not used for long code blocks, and limited in terms of returning and reusing.

  • @music_a388
    @music_a388 2 месяца назад

    👍👍👍

  • @dagim6625
    @dagim6625 7 месяцев назад +1

    We luv bro

  • @tara2337
    @tara2337 4 месяца назад

    cool and useful tutorial *-*

  • @ahmetaydn4416
    @ahmetaydn4416 2 года назад +1

    cool

  • @user-mq6ju8hl1r
    @user-mq6ju8hl1r 11 месяцев назад

    thx man i really am enjoying your vids

  • @sergiohoyos5752
    @sergiohoyos5752 7 месяцев назад

    Very clear explanation, thanks.

  • @LaughingTrios
    @LaughingTrios 3 месяца назад

    nice bro

  • @maxdonify
    @maxdonify 2 месяца назад

    Nice 👍 please explain how to use lambda inside a function Sir

  • @DS.Fahad03
    @DS.Fahad03 4 месяца назад

    Thank you so much

  • @switch1e
    @switch1e Год назад

    Great video man, really helpful

  • @shirinkhorchid5169
    @shirinkhorchid5169 5 месяцев назад

    Thank you

  • @kristijanlazarev
    @kristijanlazarev 6 месяцев назад

    Its like the difference between function and arrow function in js
    Here its function and lambda function

  • @imadiman528
    @imadiman528 Год назад

    You're awesome man we support you

  • @ohChardy
    @ohChardy 5 месяцев назад

    man all functions should inherit lambdas style: simple and easy

  • @ninavanleeuwen1183
    @ninavanleeuwen1183 6 месяцев назад

    Nicee

  • @nischalkandel9034
    @nischalkandel9034 4 месяца назад

    I have come this far my master may the force guide me

  • @bnm7898
    @bnm7898 Год назад

    bro codes the best

  • @rubenc4696
    @rubenc4696 4 месяца назад

    Thanks

  • @MiScusi69
    @MiScusi69 15 дней назад

    I

  • @JamesBond-jp6dp
    @JamesBond-jp6dp Год назад

    I saw in your full 12 hour course and some of your other videos you always use a string space but it might be easier to just use a comma which does the same thing in strings, when concatenating strings, if you use commas e.g.
    first_name, last_name # does the same thing as # first_name+" "+last_name

    • @JamesBond-jp6dp
      @JamesBond-jp6dp Год назад

      @Eugene I cant see your reply here but I have read it, thanks for the information, I am a beginner(ish) so that is useful for me thanks

    • @rostats6451
      @rostats6451 Год назад

      @@JamesBond-jp6dp Using f strings are better, print(f"Hello, {var_name}!")

  • @devfaldu9216
    @devfaldu9216 Год назад

    Thanks man!

  • @AnishSaha_
    @AnishSaha_ 3 года назад

    Awesome Content Keep it up!!! 👍👍👍👍

  • @MuhammadMorsy-pp4xm
    @MuhammadMorsy-pp4xm 10 месяцев назад

    Great as always

  • @CatholicWeeb
    @CatholicWeeb Год назад

    Thanks so much man!

  • @fvazquez64
    @fvazquez64 10 месяцев назад

    Thanks Bro!

  • @ZeuSonRed
    @ZeuSonRed Год назад

    Thank you!

  • @bekturasanbekov1979
    @bekturasanbekov1979 Год назад

    thx 4 vid bro !

  • @sadeghkhosravi
    @sadeghkhosravi Год назад

    Thank you sir!❤❤

  • @alaidarooscode
    @alaidarooscode Год назад

    helpful video 👍

  • @aerogomas5765
    @aerogomas5765 Год назад

    Thanks for sharing.

  • @dhananjayadhari6481
    @dhananjayadhari6481 Год назад

    Good explanation sir

  • @YouGotCAGEDyt
    @YouGotCAGEDyt Год назад

    thank you bro code

  • @aryanred2490
    @aryanred2490 10 месяцев назад

    Love u❤

  • @v_isforvictory9366
    @v_isforvictory9366 11 месяцев назад

    love you bro

  • @lw9954
    @lw9954 2 года назад

    TY bro

  • @Rajkumar_Tripat
    @Rajkumar_Tripat Год назад

    thanks bro

  • @Dunith_Munasinghe
    @Dunith_Munasinghe Год назад

    Thank You❤

  • @kippenvogelchen9717
    @kippenvogelchen9717 3 года назад

    ty!

  • @Freyaris
    @Freyaris 2 года назад

    Thank you soooooooooooooo much

  • @user-zs2rb2zn8z
    @user-zs2rb2zn8z Год назад

    great as always

  • @jk_sathish
    @jk_sathish Год назад

    you are always great bro

  • @youngwolf421
    @youngwolf421 Год назад

    Top Tier Knowledge!

  • @EissaAlahdul
    @EissaAlahdul 2 года назад

    Thanks!

  • @piotrkopcewicz5227
    @piotrkopcewicz5227 Год назад

    really amazing !!

  • @user-rk9jw3ub9d
    @user-rk9jw3ub9d Год назад

    hi Bro code!!!, can you help with one task that i needed to solve but i don't understand how to solve it, and with help of lambda i should solve it, we had a list of numbers, and i should with help of lambda create a function that gives us a sum of numbers like 2, 4, 6, 8, 10 can you help and give some advices how to do it please!!!

  • @ohimdabiggestbird
    @ohimdabiggestbird 2 месяца назад

    we love you

  • @uuhju7004
    @uuhju7004 3 года назад

    TY

  • @178fahimahmed7
    @178fahimahmed7 3 года назад

    new for me.. thanks... :)

  • @anzoanz1842
    @anzoanz1842 3 года назад +1

    Λλ lambda aka Greek letter as "Ll"

  • @MY-pj3gf
    @MY-pj3gf 2 года назад

    thank you good sir

  • @trungdang4008
    @trungdang4008 3 года назад

    tks bro!! it's great

  • @FireWallRocket
    @FireWallRocket 3 года назад +4

    is that half life logo xD ?

  • @khaledbeenshams8321
    @khaledbeenshams8321 6 месяцев назад

    done the three steps of bro code

  • @HussainAli-sb1dv
    @HussainAli-sb1dv 10 месяцев назад

    love u

  • @ayoubadil9425
    @ayoubadil9425 Год назад

    thank you bro😊

  • @CMT-p6q
    @CMT-p6q Год назад

    well yes, I did learn something knew

  • @arshiaa104
    @arshiaa104 Год назад

    bro thanks man thanks

  • @beingzero7541
    @beingzero7541 2 года назад

    Wow!

  • @irajgharaee7057
    @irajgharaee7057 2 года назад

    Amazing

  • @Jaxen18
    @Jaxen18 2 года назад

    best bro

  • @WindowGH
    @WindowGH 2 года назад +2

    HALF LIFE λ

  • @feetus6548
    @feetus6548 3 года назад

    good shit

  • @miquelr2353
    @miquelr2353 Год назад +1

    I asked chatgpt to explain this to me 20 times and I still didnt get it. Now I do

  • @bipolarus
    @bipolarus Год назад

    Hey Bro! Thanks for your videos. Could you please explain when I should use lambda instead of def? It is basically the same thing, so why create two different ways to write a function?

    • @jqts1147
      @jqts1147 Год назад

      lambda is shorter and faster

  • @nitaikodkani
    @nitaikodkani 3 года назад

    Too good

  • @Adamelamine
    @Adamelamine 2 года назад

    DROP A COMMENT

  • @ronaldybanezjr4721
    @ronaldybanezjr4721 Год назад

    Bro code? Is lamda function can be used in zip code?

  • @ajayiabimbolasamuel7391
    @ajayiabimbolasamuel7391 Год назад

    Still very useful in 2023

  • @GlennMelingPhotography
    @GlennMelingPhotography 4 месяца назад

  • @YamiAcZ
    @YamiAcZ 4 месяца назад

    I know its late but ill drop a comment anyway

  • @guilhermeinlumine
    @guilhermeinlumine 6 месяцев назад

    lambda is the dark souls shortcut. use it.

  • @LurkerAnonymous
    @LurkerAnonymous 5 месяцев назад

    based and lambda pilled

  • @user-dv7mr6mu7w
    @user-dv7mr6mu7w 7 месяцев назад

    The BEst!