Python LAMBDA FUNCTION?!

Поделиться
HTML-код
  • Опубликовано: 26 окт 2024

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

  • @b001
    @b001  11 месяцев назад +1201

    Yes, this video is slightly sarcastic. I would never use it to calculate 1+2. I used an extremely trival problem so that I could better demonstrate the syntax of lambda functions.

    • @MrWayneDX
      @MrWayneDX 10 месяцев назад +22

      That made me understand this less. Why would you do that when you can just print(X+Y) or print(1+2)?

    • @xinaesthetic
      @xinaesthetic 10 месяцев назад +44

      ​@@MrWayneDXI think the video would've been better if it showed how it can be used when mapping over an array or something.

    • @muhammadqaisarali
      @muhammadqaisarali 10 месяцев назад +1

      Damage is already done. U can recover you honour now. 😊

    • @bruhstandler
      @bruhstandler 10 месяцев назад +3

      @@MrWayneDXYou wouldn't but there are a lot of other instances where it would be easier to define a function and use it all in one line instead of wasting 3 lines of code on it.

    • @OneWeirdDude
      @OneWeirdDude 9 месяцев назад +1

      Ah, okay. How about a serious one, then?

  • @heddevh
    @heddevh Год назад +6714

    Can you make a tutorial for 1+3 next?

    • @Jefferson31
      @Jefferson31 Год назад +176

      ​@Darth Vader and 3+1?

    • @andreab5185
      @andreab5185 Год назад +243

      ​​@Darth Vader No need. Already written my code and It says: 31

    • @youber3200
      @youber3200 Год назад +162

      this is how i calculate 1+3
      def add(x, y):
      sum=0
      for i in range (x):
      sum+=1
      for i in range (y):
      sum+=1
      return sum
      print(add(1,3))

    • @heddevh
      @heddevh Год назад +52

      @@youber3200 that's so cool it worked! There might be a small efficiency problem though, so do you think it could manage 1+4?

    • @andreab5185
      @andreab5185 Год назад +21

      @@youber3200 There are too few operations and lines of code, this can't work.

  • @aceplayer555
    @aceplayer555 Год назад +3767

    Lambda functions are just like regular functions, except they make your coworkers hate you.

    • @Millio_4_reallio
      @Millio_4_reallio Год назад +33

      Haha why so? I’m new to programming

    • @aceplayer555
      @aceplayer555 Год назад +467

      @@Millio_4_reallio They're just significantly more difficult to read and understand if you're not used to them.

    • @hyde4004
      @hyde4004 Год назад +117

      They're not hard to understand if they're used for what they're supposed to be used for, simple and short expressions that can be easily expressed in line.

    • @icakinser
      @icakinser Год назад +28

      I had to follow-up a guy that LOVED them. I swear every other line was a LAM

    • @samcolton943
      @samcolton943 Год назад +8

      so do you really only use these in specific use cases, or just try and avoid them? Or is it just personal preference? Just out of curiosity of course, I'm in the networking field but I'm teaching myself to code.

  • @moustachemewe
    @moustachemewe 5 месяцев назад +226

    I swear someday someone is going to figure out a Python one-liner that attains world peace but no one is going to use it because its "not easy to read"

  • @timilehinorawusi
    @timilehinorawusi Год назад +405

    Note : lambda has many use cases , but key places to use lambda are in amp and filter function please learn about map and filter and how to use lambda in them . Very useful !! 😊

    • @ChannelCheesecake
      @ChannelCheesecake 10 месяцев назад +1

      It’s just easy bro

    • @givrally7634
      @givrally7634 8 месяцев назад +2

      Max, min, and sorted as well.

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

      @@NickMak-m2c Both of the above functions, as well as min/max/sorted, take in an iterable (list, tuple...) and a function, and apply that function to each element of the iterable. map returns the result, while filter returns an iterable with the unchanged elements, but only those where the function returned True. As for min, max, and sorted, their optional "key" parameter applies the function to each element and then works with the resulting values instead of the original values.
      If you don't use lambda, you have to create a new function every time you want to use them. For example, if you want to sort a list of 2-tuples based on the 2nd element, you have to create a function def f(x): return x[1]. That wastes 2 lines, 4 if you comply with PEP8, just so you can write "key=f".
      If you use lambda, you can create that function in an "anonymous" way, meaning you don't give it a name or anything, it just does something simple. In this case, you could write "key=lambda x: x[1]" and you'd be done. Assigning a name to it is possible, you could write "f = lambda x: x[1]", but it's not recommended in most cases.
      This makes things so much more readable in functions, and makes them so much more powerful.

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

      I agree my friend.

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

      I’ve never come across a situation where lambda map or filters are easier to write or read than comprehension lists

  • @so_ma_music
    @so_ma_music Год назад +379

    WOAHHH thank you!! Just started learning Python recently and lambda definitely was a weird one to learn for me personally, but this all makes sense now 🙏

    • @vorpal22
      @vorpal22 Год назад +12

      Lambdas in Python aren't great... you can actually assign them to variables, though:
      my_lambda = lambda x, y: x + y
      Then you can call it like any other function:
      my_lambda(1, 2)
      Most programming languages support multi-line lambdas and they're essential in functional programming. They're just anonymous functions that you don't need to declare and keep around, and if you have something like Kotlin, they are extremely powerful.

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

      Hey I just started learning python too, do you have any advice about indentation?
      I get the basics of it but sometimes it gets confusing. Is there a rule or pattern?

    • @vorpal22
      @vorpal22 Год назад +4

      @@originaljokester7679 The indentation in Python is absolutely required to delineate code blocks because there are no braces like other languages.
      Foe xample:
      if cash > 0:
      pirin('You do have cash!"
      else:
      print('Poor as dirt...."
      If you don't insert the indentitation (usually four, sometimes two if you want), then Python doesn't know how to process a block.

  • @coldenate
    @coldenate Год назад +6

    Dude, this is the best use case of short form content…. learning!? Brilliant 👏👏

  • @elgatorado4907
    @elgatorado4907 Год назад +196

    My professors teaching me Lambda as if I'm not going to just use regular functions anyway

    • @philippebaillargeon5204
      @philippebaillargeon5204 Год назад +29

      Your teacher is teaching you that because you will eventually need it. Lambda are essential to keep a clean code and improve readability. Any good programmer knows how and when to use lambdas.

    • @elgatorado4907
      @elgatorado4907 Год назад +17

      @@philippebaillargeon5204 I know, I understand that now. I was just joking about my attitude back then. I understood how to write functions and recursive functions and even did it well but I was so hung up on thinking that Lambda was a waste of time and an insult to all the effort I put into everything that did the same thing. I'm a little more experienced and greatly more appreciative now

    • @64imma
      @64imma 11 месяцев назад +4

      I'm mainly learning game development, so for me, lambda functions have been useful mostly for me in being able to pass a function that requires parameters in places where it's normally not allowed.

    • @johndoe7017
      @johndoe7017 2 месяца назад +1

      It’s really useful for doing function calls in places where you normally would not be able to pass arguments

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

    There is no way that you make me understand a concept that took me like 2 hours to parcially understand in just 30 seconds... thanks dude

  • @gottem_
    @gottem_ Год назад +44

    Damn, I thought it would write the whole Half-Life code for me.

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

    I myself never really understood lambda functions, until I watched this video and it clearly explained it in a concise way with a rather simple example. Very good job!

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

      try to code lamda funcrion in other languages and you will understand why its so cool and easy to use. Unfortunatly python does not represent lambda fucntion like in other languges. In python its just boring and useless shit.

  • @BearfootBrad
    @BearfootBrad 11 месяцев назад +2

    More python shorts please! This is so helpful

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

    You my friend just summed up the whole python philosophy!

  • @hhill5489
    @hhill5489 Год назад +6

    Using lambdas along with map to perform fast operations on lists is what got me into them

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

    I love this content. It is pleasant and simple and helps remember useful stuff. Please keep making more. Lots of programmers ego can be seen in the comment section, which should be ignored.

  • @laddukavali3324
    @laddukavali3324 2 месяца назад +1

    Excellent explanation,very simple to understand 👍🏻👍🏻♥️

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

    This was a much more succinct explanation than I've heard elsewhere. Thank you.

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

    wow! one of the few programming shorts that is actually useful and very well explained. Good job!

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

    Please make shorts on other python topics..Loved this one.

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

    The best and easiest way i ever saw someone explain lambda. ❤. Thanks mate

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

    Can’t wait for the useful case video, thanks mate !

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

      I use lambda frequently when providing the “key” keyword argument of sorted() or list.sort(). Sure, you could define a function specifically for a special sort, but if you know you will only ever use it on one line of code, you might as well keep that sorting logic all on one line of code.

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

      he is showing things in useless cases to make it easier to explain, you when you are writing code you will need to know how to use the things you learn in a useful way

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

      @@GuizinPE81 yeah mate, reason why I wrote that comment 💪🏽💪🏽💪🏽

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

      @@JordanMetroidManiac in a dict for example ? Can you be more specific ? (I’m a noob over here hahaha)

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

    I wasn’t used to lambda functions until I learn JavaScript. And honestly… they make everything so much easier and quicker.

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

    As a physics students, incase anyone is curious Lambda is also in physics the distance between 2 complete pulses in a wave

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

      Wavelength!

  • @Mikequez-12
    @Mikequez-12 Месяц назад +1

    Also you can conver a function with arguments to an object. (Example):
    def add(x,y):
    return x+y
    print(add(1,2))
    # 3
    print(lambda:add(1,2))
    # object element

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

    Thanks for posting. I know many others who start out with Python and struggle with understanding lambda functions.

  • @tylerdurden4285
    @tylerdurden4285 Год назад +7

    Keep making these videos. This was really helpful and simple to understand.

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

    Whenever I think of lambda function in Python, I think of anonymous function. So lovely to use, yet takes a good amount of practice to master.

  • @swizice
    @swizice Год назад +11

    I cannot begin to say how well done and concise this explanation is…you, sir have won the month of January! 🎉

  • @TheReesesGuy
    @TheReesesGuy Год назад +74

    This was so helpful. I have never understood Lambda

    • @QQnowQQlater
      @QQnowQQlater Год назад +13

      you still dont if you think this is how to use these

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

      Just think of them as the simplest possible kind of function. Assign one to a variable (like any other value) and you have a small reusable function.
      Why do they exist? In Python, mostly just as "syntax sugar" - a concise way to write tiny functions.
      They aren't necessary. You could always define a normal function instead. But for tiny functions, it's nicer to have a tiny syntax to go along with them.

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

    Incredible. I'm all ears for 1-2!

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

    Annonymous functions are popular in JavaScript, where they enjoy being wrapped around eachother in an endless web of confusion.

    • @timber2lease
      @timber2lease 11 месяцев назад +1

      in js, anonymous functions is something different

    • @hueman4927
      @hueman4927 11 месяцев назад +1

      @@timber2leaseI’m pretty sure that Anonymous Function = Arrow Function (js) = Lambda (python)
      But there are probably some scoping differences here and there, idk

  • @flowrling
    @flowrling 9 месяцев назад

    i dont code in python much (or at all) but i do make spreadsheets and ive seen the =LAMBDA function but never understood it so this was actually useful

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

    Great explanation. Thanks!!

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

    major use case of lambdas:
    assume you have multiple lines of codes which take similar inputs and applies a function to them in an abstract manner. you can now create a function which takes a lambda as an input and simplify your code. i.e. to build a simple calculator:
    def main():
    x = float(input("first number: "))
    y = float(input("second number: "))
    operation_type = input("choose one from: add, sub")
    add_lambda = lambda x,y: x + y
    sub_lambda = lambda x,y: x - y
    if operation_type == "add":
    chosen_operation = add_lambda
    elif operation_type == "sub":
    chosen_operation = sub_lambda
    print(calc(chosen_operation, x, y))
    def calc(operation, x, y):
    return operation(x,y)
    of course this is a low-level example, but it shows the possibility to remove code redundancy in more complex programs

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

    Started needing lambdas when I needed to add a function as an argument.

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

    actually really helpful, been confused on stuff like lambda and using classes for a while, was able to easily understand. :D

  • @thepenguin9
    @thepenguin9 10 месяцев назад +2

    Instructions unclear, caused a Recursion Cascade and now I have to save the facility

  • @Kadori328
    @Kadori328 Год назад +64

    If I see a junior developer do this just know I'm breaking your keyboard

    • @dangdrjay3011
      @dangdrjay3011 Год назад +4

      Why

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

      @@dangdrjay3011because they don’t understand what the value of anonymous functions is and they have anger issues…

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

    For those wondering: this is useful for functional programming where you might wanna use functions as input for other functions.

  • @Zxv975
    @Zxv975 Год назад +56

    The core use of a lambda is explained in the video, but I'll just explain a bit further for anyone confused.
    Functions are good programming practice because they group chunks of similar code (closure) and they allow for reuse by referring to the function's name later in the code.
    But what if you want the benefits of closure but you don't want to reuse a piece of code? You would then use an anonymous function which has no name and therefore can't be referred to elsewhere in the code. Lambdas are pythons version of anonymous functions.

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

      wow it makes sense ayo

    • @AJ.911
      @AJ.911 Год назад

      So if I want to pass new inputs I have to define a new lambda line?

    • @Zxv975
      @Zxv975 Год назад +8

      @@AJ.911 if you're going to be reusing it, then you probably want a named function and not an anonymous function.

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

      Lambda is what they're called in Haskell and Java too.

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

    This does seem a little extra but it’s just the most basic of use cases for these. There are actually many uses to lambda functions, for example sorting by a certain attribute in a class with the .sort() function, or passing a function as an argument into another function.
    For example, if you had a list of 100 names and you needed to change them in several different ways, you can make a function:
    def permute(list_names, func):
    for i in range(length(list_names):
    func(list_names[i])
    Then you could pass a lambda function as an argument into the above function. This use case is also a little silly in terms of effectiveness but it is more like where you’ll actually see them

  • @isoceptic
    @isoceptic 10 месяцев назад +3

    'lambda'
    half life 2 flashbacks

  • @naniv
    @naniv 9 месяцев назад

    Love your videos bro

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

    You're my hero 😮.. Finally I got it 🎉🎉🎉

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

    Oh yessss. I'll steal your idea (for youtube shorts videos never done it before).
    P.s. I'm kinda joking, the video is great! I liked and subscribed, keep up a great job!

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

    for their practical use, they are good for callbacks.

  • @maighe_tv2848
    @maighe_tv2848 9 месяцев назад

    I love python because you just write lambda instead of having some weird specific notation for it

  • @victoraghaebita2090
    @victoraghaebita2090 10 дней назад

    We were taught this today. The tutor can’t teach for sheeet! I just watched a short video and understood it better.

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

    Lambda helps a lot when working with group by operations in dplyr.

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

    Also, fun math trivia, lambda calculus is something called a functional programming language, which means a programming language dependant mostly on functions
    Lambda calculus is a special type of that programming language, as it ONLY consists of parameters and functions. It's also the very first functional programming language or even the first programming language and computer to ever exist.
    It also lead to the Entscheidungsproblem or choice-problem in english which proved that some problems are unsolvable.

  • @EgeQaqd
    @EgeQaqd 11 месяцев назад +1

    When I made buttons with Tkinter I found out that I need lambda to use a command with parameters

  • @beepymemes
    @beepymemes 7 дней назад

    An actual use case for this is methods that take a callback as a parameter. Example:
    instead of
    _def stop():_
    _motor.stop()_
    _on_keypress_A(stop)_
    you could do
    _on_keypress_A(lambda: motor.stop())_
    which is much cleaner and easier.
    Edit: fixed italics

  • @PS_Tube
    @PS_Tube 9 месяцев назад

    The first time I found a lambda function in Python, I was amazed. 🐍 is ❤️

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

    wow now I understand how useful it is...

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

    In JavaScript (and probably other languages too) this is called an IIFE. In JS, you don't need any fancy keyword. You just need to surround the already-existent function declaration with parentheses, and then call it in the same way you would any other function.

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

    Made it look so easy

  • @TimeManInJail
    @TimeManInJail Год назад +8

    Cool, something new I learned today. I heavily rely on this channel

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

    Even a old C64 had that called "Def". You showed a unnamed lambda, so it can not be reused. You can say "A=lambda..." the A is more like a function. Sometimes you need to use function, so you can put it in a lambda.

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

    That s what I needed to know, thx.

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

    If you want a named function without writing "return" for a reason, use this syntax:
    functionName = lambda params: return
    With functionName being the name of the function, params the parameters (a, b=0, *c, **d) and return is what is returned by the function
    For example with the function "add" taking 2 numbers as arguments and returning their sum:
    add = lambda x, y: x+y

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

    You just demystified a concept that I keep having to look up every time I encounter a lambda in someone else's code in a way that the not even GeeksForGeeks could do for me.

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

      Just think of it as an anonymous, unnamed one line function.

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

      @@vorpal22 Well, I don't tend to use those in my code yet, so that explanation still wouldn't have helped me in the past.

  • @vicky-mc8063
    @vicky-mc8063 11 месяцев назад

    Lamdas are the best dude... In every language.... It makes outlr job easier

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

    An idiot admiries complexity, a genius admires simplicity.
    ~ Terry Davis

  • @vinnieg6161
    @vinnieg6161 Год назад +44

    as someone quite new to programming it just looks like you made a simple 1+2 into an overly complicated quantum physics problem

    • @kipchickensout
      @kipchickensout 11 месяцев назад +14

      as someone not new to programming, yes he did

    • @epsi
      @epsi 10 месяцев назад +2

      names = ['George', 'David', 'Sam', 'Rob']
      names.sort(key=str.upper)
      Sorts by name in a case-insensitive manner.
      If you only want a partial sort based on the first letter of a given name, instead of the entire name, you can use a lambda that returns the first letter, optionally applying str.upper() to that letter:
      names.sort(key=lambda s: s[0].upper())
      Lambda in Python is intended to be used for that kind of thing - a short, uncomplicated function you only need for one particular use case.
      You might use it to sort even numbers before odd numbers for whatever reason:
      nums = list(range(10))
      nums.sort(key=lambda n: n%2)
      The demo was a bad example, intended to illustrate that it's the same as a function, forgetting to illustrate why you might prefer it over a named function in the first place.

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

    great explanation

  • @reeti5958
    @reeti5958 8 месяцев назад +9

    Word of advice, if you are making a video about lambda functions, actually explain its use case instead of just writing 1+2 to show that you can do it like that.
    Lambda functions are really important and useful functions which allows us to pass values to other functions by implementing it in a single line. You won't understand its usecase in web programming but it totally make sense in application programming. I always end up using them in my kivy click event code because kivy doesn't let me pass the values directly or passes a reference that I don't need in my listeners. Thus wrapping the listener call with lambda functions helps to keep code compact and understandable.

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

    They are like arrow functions in js, mostly passed as callbacks

  • @morsuk
    @morsuk 9 месяцев назад

    It's very often used in tkinter to pass arguments on command functions

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

    Solid prank to pull on my professor before my next homework is due 😂🤦🏼‍♂️😭

  • @nopenevermind8559
    @nopenevermind8559 Год назад +47

    I take the first one, the easiest. 🤣

  • @synsez
    @synsez Год назад +57

    Thanks!

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

    Liked and subbed.
    Cool little explanation!

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

    I am not coding person , I learnt C , c+ when I WAS in polytechnic college, it was just 6 month of course besides my main course, But now I am in love with this python.

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

    This music bops

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

    it would've been good to show a real use case here

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

    I used lambda very much when using TK library.

  • @Mayeloski
    @Mayeloski 16 дней назад

    always heard of lambda but never got to use it or actually see it, seems like arrow functions in JS, cool

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

    Lamba functions are like ternary if else statements. If it's a simple function, just reduce it to a single line

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

    The only ever usecase for those i saw in the map-reduce algorithm

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

    nice, simple, beautiful

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

    Amazing video ❤

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

    Python discovers anonymous self invoking functions

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

    This is interesting, I'll try to figure it out on where it can be used.

  • @AdityaKumar-dv9cp
    @AdityaKumar-dv9cp Год назад

    Its been months and i have never understood LAMBDA.. But this short vid.. Made it. Possible

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

    Great. Nice music too

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

    It's frequently used in ML for one time data manipulation

  • @Tenkite001
    @Tenkite001 8 месяцев назад

    Him : it's not funny with one line
    Also him : IT TAKES 3 LINES OF CODE

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

    In this case, you could use the operators module.

  • @perplexedon9834
    @perplexedon9834 8 месяцев назад

    Even this simple example could be appropriate if the evaluation required referencing another variable multiple times. If you wanted to evaluate x^2 + xy + y^2 on a variable with an unwieldy but descriptive name, such as "inputValueX" and "inputValueY" then it would be the following:
    Typical application:
    print(inputValueX ** 2 + inputValueX * inputValueY + inputValueY ** 2)
    With lambda:
    print( (lambda x,y: x**2 + x*y + y**2)(inputValueX, inputValueY) )
    I'm not defending these particular variable names, but I actually find readability improves with lambda, and that's a very simple example compared to what some applications may need.

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

    Thank you for your videos 😊

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

    That's soo exhilarating

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

    For someone might wondering, lambda is from lambda calculus. It's a theory of computing and lambda is even older than python lol. And the way you write lambda is a little weird, optimization should be lambda x: lambda y: x + y.

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

    In python I find I use lambda the most when I need to pass parameters to button commands in things like tkinter userforms.

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

    For anyone curious about this type of function, it’s called an anonymous function because it isn’t given a name. It cannot be called by any other code. This exists in other languages as well

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

    By any chance, have you made a tutorial for using python to solve complex mathematical problems ?

  • @uuu12343
    @uuu12343 9 месяцев назад

    People joke about trivial problems like 1+2 or 1+3, but there genuinely is a mathematical problem that is part of the millenium problems known as the
    "a + b = c" conjecture

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

      It's just a logical consequence of the definitions of 1, 2, and 3 that make these statements true.

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

    bro really using lambda to slove 1+2 💀

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

    Basicamente uma função anônima. Em JavaScript seria algo como (x,y)=>{return x+y }(1,2)

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

    What is this font? Looks gorgeous

  • @HariKrishnan-jm9cy
    @HariKrishnan-jm9cy Месяц назад

    Man , the audio is really good, but pls low down the volume, it is in the verge of getting distracting us from the video...