Lambda Expressions & Anonymous Functions || Python Tutorial || Learn Python Programming
Вставка
- Опубліковано 11 вер 2024
- 𝙎𝙩𝙖𝙮 𝙞𝙣 𝙩𝙝𝙚 𝙡𝙤𝙤𝙥 𝙄𝙉𝙁𝙄𝙉𝙄𝙏𝙀𝙇𝙔: snu.socratica.... Lambda expressions - also known as “anonymous functions” - allow you to create and use a function in a single line. They are useful when you need a short function that you will only use once. For example, when using the map, filter and sort methods.
Please SUBSCRIBE: bit.ly/Socratic...
This video was made possible with the help of our Patrons on Patreon! We would especially like to recognize the generosity of our VIP Patron, Austin Anderson. We're so thankful for your support, Austin!
To learn Python, start our Python Playlist HERE:
bit.ly/PythonHe...
♦♦♦♦♦♦♦♦♦♦
We recommend:
Python Cookbook, Third edition from O’Reilly
amzn.to/2sCNYlZ
The Mythical Man Month - Essays on Software Engineering & Project Management
amzn.to/2tYdNeP
Shop Amazon Used Textbooks - Save up to 90%
amzn.to/2pllk4B
♦♦♦♦♦♦♦♦♦♦
Ways to support our channel:
► Join our Patreon : / socratica
► Make a one-time PayPal donation: www.paypal.me/...
► We also accept Bitcoin @ 1EttYyGwJmpy9bLY2UcmEqMJuBfaZ1HdG9
Thank you!
♦♦♦♦♦♦♦♦♦♦
Connect with us!
Facebook: / socraticastudios
Instagram: / socraticastudios
Twitter: / socratica
♦♦♦♦♦♦♦♦♦♦
Python instructor: Ulka Simone Mohanty (@ulkam on Twitter)
Written & Produced by Michael Harrison (@mlh496 on Twitter)
♦♦♦♦♦♦♦♦♦♦
Wear a Socratica Python shirt for good luck coding: shop.socratica.com/products/python-by-socratica
Or just use ChatGPT?
I usually don't comment much, but this is not just hilarious, but the pace, presentation style, lack of hipster fluff is impressive and refreshing! Nicely done!
Yes, this video was very easy on the eyes.
Hello, as I am from Brazil, I would like to know the meaning of hipster fluff. Thanks
Great!
@@ruifonseca6147 It means "cheio de onda, com jargões moderninhos"
Agreed, 30 sec in and I'm already laughing. Informative+funny is a very nice way to learn new information. Love the ominous background music too (I was waiting for a Guy Fawkes mask tho xD)
I strangely have an urge to listen and absorb the material in this video. I feel like this is a matter of life and death. And if I don't understand and use lambda function correctly, this world will end.
Michael Vu the world hasn’t ended. I guess you have learnt lambda function.
Weirdly same. I wish she was my teacher.
So go and learn it asap hahhahah
..and lambda is so much more potent than explained in this video.. hope you use lambda correctly, this world may not end.
LMAO!
The quality of these python videos is actually incredible.
Agreed... Wait, your are
TheLyreLiar
?
It's like watching sifi movies
Indeed!
I second that
@@hangchen thats true!!!
I felt like going through a tutorial in a game. She somewhat feels like the adjutant in StarCraft and a cool and hype mission is about to happen.
Welcome back, Commander!
Exactly that, this feels like either game tutorial or cyberpunk hacking video.
+1 for most accurate video description ever
"Some people do not know how to use the shift key"
This is the greatest truth of the universe.
i uSe tHE caPs keY
naw it's just tedious to move your finger, hold it down whilst typing. it screws up ur typing momentum.
@MatZ just because one is lazy to do "the said thing" does not mean he doesnt know how to do it.
Learn to comprehend
@MatZ it's more a factor of laziness
It's official! The Socratica Python Kickstarter was a success! Thank you to all of our supporters. Because of you, many more Python videos coming soon!! 💜🦉
Liked the way of presenting the topic
Feel free to come anytime your ready!
Thank you for this amazing job.
Just some tips for the next serie...
Most of the time, the most important line of code is at the very bottom of the videos. Thus, It is often hidden by the UA-cam player, or by the subtitles (if you activate it). A little bit upper would be perfect :)
Well that was possibly the most entertaining Python video I've ever seen; it was a great explanation as well. This is the first Socratica video I've watched, but I'll definitely make a point to watch some more.
mee too
Same!
Me too.
Thx skynet for teaching me python
You just made python 100x more interesting than it already is. Thank You!
I've been coding for almost two years and yet that's the most innovative tutorial I've ever seen
"I hereby grant you the power to collest vast amount of personal data to do with as you wish." 1:58 Just Brilliant :D
a good news to unknowners
Welcome to Socratica! You can see our entire Python Playlist here: bit.ly/PythonSocratica
Subscribe to see all our new videos! bit.ly/SocraticaSubscribe
great video...
seems like Halo cortana is teaching me
@radheekrshn and Tkinter!
We're glad you've found us! You can subscribe to Socratica here: bit.ly/SocraticaSubscribe
To help us make videos faster, you can become our Patron! www.patreon.com/socratica
Looks like ASMR for Programmers
Best Python tutorials on the web. Keep'em comin! :)
the best python programming channel on the youtube is back with another outstanding video Welcome Back!!
For some reason I've always avoided your videos... now that I watch this lambda one... I'm hooked! Easy clear concise explanations, sorry I judged you!!!
That's a very interesting new style of tutorial, very refreshing ... gj
Clear, absorbable, AND funny? How is this a python tutorial?! Subscribed!
I really like the mathematical spirit of this channel you are the best
Gatsu
I don’t understand how you keep a straight face. Thank you for the entertaining tone.
I love everything in this video. The pace, the music, sound effects, the learning. Excellent.
you forgot the comedy!
I tried out all channels to learn lambda functions, out of all believe me this channel is amazing, I love the way of teaching because I just learn from here lamda functions. I never understand wikipedia and all other programming channels
Everyday I watch at least one Socratica Python video and then do one algorithm from Hacker Rank as a practice to start my day
This sounds like a great way to get into peak mental shape!! Thanks for watching!!
The quality of this video is simply stunning. Can't believe I only stumbled upon this just now.
That joke about Euler almost killed me
hahaha dead
LOL,yea. Damn cool!
As it well should!
The least I can do to repay your efforts is by subscribing and liking this tutorial. Fab work
I listen to these videos at 2X speed... and I appreciate that your videos actually are well annunciated for that reason
a function has no name! LIAR! *hits with stick*
GOT
omg this is exactly what i thought of when i heard her saying it...
hahah Awesome
Updated:
Lambda: "And what do you say to a function with no name?"
Araya: ""Not TODAY !!!"
Just when I stopped giggling over America's song "A Horse with no name".
So was that a Lambda Horse?
I really appreciate that you show real world examples for all these lessons
I am so happy so see another female programmer! and this is super interesting. Thank you
Monica Barrow yeah it always pleases me to see a female doing these kinds of stuffs
Well, she is a professional actress, not a programmer. See her webpage at ulkamohanty.com/, she mentions her socratica videos here.
@@mezigueescartefigue1254 Did you read Ulka's CV carefully? She's an actor AND a programmer. She has a degree in Computer Science from McGill University. She's also a choreographer and an incredible chef. We're lucky to work with such talented people!
There are a million
@@mezigueescartefigue1254 sexist scumbag.
We're halfway there. We still need your help! Support Socratica Python Kickstarter: bit.ly/PythonKickstarter
2:55 - You pass the butter.
Lambda : "Oh my God."
I understood that reference
A tad bit late, but me too!
This is me watching your video for the first time. I did not know that someone actually taught like that. I am amazed.
"I was programming in the desert in a function with no name..."
I've been through the source code on a function with no name.
I don't knnow how I ended up in this channel but I'm both amazed and learning python
Congrats from Brasil
was just thinking of all the programming channels on youtube, haven't seen a single woman teaching! Then there you are! yay!!!
Thank you for your kind comment, Wing! We are a team here at Socratica (both men and women) and we achieve together!
Just watched your wonderful channel trailer. I hope everyone watches it and is inspired: ua-cam.com/video/eX4VkEnpmUQ/v-deo.html
Certainly! It just felt like women seem to be a bit underrepresented in this arena.
I'm so flattered that you liked my video, there's lots to improve on, but your encouragement will motivate me to create more in the future. Thank you!!!!!
We totally hear you. We're baffled by the under-representation of women in STEM...the other side of the coin is that so far we don't have that many women watching our channel. Hopefully that is slowly changing. We need everybody's brainpower to have a bright future for the world!
Keep us posted on how your work goes! :)
Will do! Thank you for the wonderful videos.
@ Wing N.
It seems you have committed an error: Ulka is married.
Don't give up hope. There may be single women teaching programming elsewhere.
(HeeHeeHeeSnort)
The dramatic way she was speaking caught my attention 😀😀😀😀😀 ..Really value adding video, Thank You
I love the fact that the girl holding back her laugh in the intro 😂
Best python video till date, in terms of fast pace, to the point content, and the fun you add to it. Kudos.
best python tutorial on the internet!
First time commenting on any learning video, your teaching style made me do it. Loved your way of explaining. Now I will surely become a pirate:).
Finally I can become a pirate as I know how to calculate the trajectory of a cannon ball.
i dont know why, but the thing i am most exited about is that i now know i can get the last element of a list by getting the -1 element.
I played around with it a bit, and apparently by getting the -2 index, you get the second to last index and so on. I dont know why i never learned this, but it is awesome!
So ... what is the point of a Lamda? Seems like you can name it similar to a normal function, so why not simply use a normal function; or you just use it once in which case you don't need a function at all just use standard old inline procedural style code.
As a person who just started learning the lambda, it seems to act like a placeholder.
I would think its more concise than regular inline procedural style and doesn't unnecessarily pollute the namespace, if you really are just using it once.
Imagine you have two sorting functions - one you only use once and the other all over your code.
If you turn the first one into a lambda expression you can simplify the name of the other function (which makes the rest of your code more concise) because you don't have to be afraid of it colliding with your lambda expression.
Fantastic explanation here on S.O.: stackoverflow.com/a/890188/8476372
It's like I'm in a mission briefing before the level starts at an FPS video game. Very well done.
Am I the only person that is digging the background noise?
nope
What noise? Get some crappy headphones like mine.
I'm loving it too!
yes
Very good too
I don't typically comment, but this video's delivery is amazing to help learn what was a very confusing topic for me. Thanks!
great style of teaching .
I can't believe this is the first video I've seen from this channel. Outstanding!
We're so glad you found us! C'mon, UA-cam - help us connect with people who need help!
Hi,
Could you please try to make a video on Multi threading and multiprocessing concepts in python
Oh my god, You're living it 2080. The way of teaching is amazing, was like watching a thriller movie😍
A hot girl, is teaching me how to code in 2017, and i'm loving it. this is truly the nuts and bolts of the language, yay i'm just so excited and happy!
You're weird.
Are we at a point where boys finding girls hot is weird?
PushMyCarr Yeah, and that's _definitely_ weird.
isfk i am.
SO she's not an android....? Damn....
My first on this channel, proof that UA-cam recommendations are working well. Earned a subscriber.
Lambdas are fine but generally should be avoided. Why? By virtue of the fact that they're anonymous, code reuse is impaired, as is caching. I'm making an extreme case here, but lambdas should be thought of as a programmers convenience and not a prescribed way to code.
I could not have said it better. There is a high probability that I could have said it worse.
Yep. As we like short functions, the possibility of lambdas as one-liners is not a real argument. Not anywhere else than at the command prompt.
As someone who regularly scrapes UA-cam for help on homework… this is officially my favorite python channel. Why didn’t this come up sooner!
"There are people who don't know how to use Shift key" ....lol
If I had her as a CS teacher in College I probably would have been coded Linux by now 😂She got me hooked up from the 1st seconds of the video.
Seriously this is by all means superior. Direction, content, pedagogy, tone, effectiveness... you name it. I am so baffled. This is the future of education IMHO.
Beyond content, the presentation is amazing, attention to details, visual effects, sound design, acting play. When Art and Code are united the result can only be hypnotizing 👏👏👏
Very good presentation, but i do think lambda functions make your code less readable therefore i will not use them. Not trying to make the world better here, but you will receive flag from me whenever i read your code reading these type of functions. They are useless. You can do much better by just writing it out, and give the reader of your code a nice pleasure instead. Believe me, you will feel stupid by making your code look stupid, but your readers will thank you. It will in turn increase software quality and colaboration. Imo do not use this kind of stuff.
You need them to be able to program in a functional way. Look for "functional python programming".
SoupIsReady - just another tool in the toolbox, and like many tools can be used in the wrong place for the wrong purpose - she highlighted that they should be used for simple throw away scenarios, the list search is a classic situation where they shine.
example of lambda saving the day: Using it to pass variables from a tkinter button into the generic function assigned to its "command" variable. Without Lambda, this would take a great deal of effort. With lambda, it is barely any extra code at all.
I tend to agree, but even if you don't use them you need to be able to read them :) Cheers.
this is my first video to solving my lambda expression problem i accidently click the video and i shocked what is happening in this video 😮 then i realized this is the good way for the programmer to interact the viewers and help them by giving accurate and sufficient way to solve their problem 😃 THANK YOU FOR THIS VIDEO I SUBSCRIBED YOUR CHANNEL AND KEEP SUPPORTING BY GIVING A UNIQUE WAY OF STUDYING 😄
There is a typo tho at 3:23,
Arthus C. Clarke
Oh man, and we watched this video SO many times checking for typos! ::bangs head on desk:: This is a good time for us to practice wabi-sabi...
As someone I know once said, "Even computers can make mistakes."
Good eye, Alper. If I had similar skills my code would have less bugs.
Just found this channel. It's hosted by an android from the future that knows a lot about sloppy humans. I instantly became a fan.
I have learned lamdba expression, I'm now 300 IQ
lambda comment: comment + " is idiotic"
This style is SO great! Jesus, I felt completely immersed in a whole different world. I can feel a relaxing cold wind behind my ears. Please, keep this format.
Haha.. very nice tutorial...marry me girl
Finaly someone showed me truely magic, rly useful. Usual tutorials about lambda doesn't explain anything (and boring). Thanks
I had to stop and look up "split" to understand why the index -1 refers to the last name. I tried this from memory and kept coming up with "s" for the -1 index of "H. G. Wells." Split actually creates a new list of strings for each part of the string separated by a space. So cool!
Support what you love! Socratica has a Kickstarter to make more Python: bit.ly/PythonKickstarter
Finding these videos extremely useful, love how she simplifies everything all while making it fun to learn
It was as if I had found a treasure that I had been searching for for a long time. My observation and advice to followers is that this method is one of the methods of explanation in higher education, meaning that every time you watch the video you will discover something new. Really, thank you very much for helping people in the world, and thanks again for the quality of the video, the likes of which I have never seen before.
This message was so touching. THANK YOU, you really made our day. 💜🦉
Python documentation is more than sufficient for learning things according to me, since i am a beginner, but this provides a very good approach as well. I watched the video and noticed that keywords from the documentation have been frequently used. So if you were wondering the authenticity of these videos. You can trust them, and use the definitions they provide in technical interviews or tests.
python, arrays and lambda expressions all rolled up into 1. i'm sold
like many people said notmally i dont comment as well .. i am still in middle in video and my heart says "Muahh i love you" not on other sense but like human to human and respectble way. Thanks , please keep doing what u doing explanation is great
The content is amazing, there's no need for this StarTrek style production. Just one screen displaying commands and results is enough. Keep up the good work.
I dont know what made you decide to make your videos like this but... thank you I cant believe how engaged I was. I loved every minute. Please continue! New suscriber and im going to watch all your videos.
Holy Hell! This is by far the best innovative video on UA-cam I have ever seen.
Wow. Just wow. This video is absolute perfection. I'm IN LOVE with this.
It seems that I've been under a rock for the past couple of years. Otherwise, how come I never came across these videos. Excellent, simply put.
I just can't say: WOW!!! great job!!!! what an incredibly creative and extraordinary way to teach!!
honestly love these videos. I've watched what feels like, 100s of them. but they're are gr8. especially the execution - good grief y'all are good at making these!
The best python tutorials ever, not only on UA-cam but almost all over the net. Thank you!
3:59 = If you can't see any results just do this:
writers=sorted(scifi_authors, key=lambda name: name.split(" ")[-1].lower())
writers
I really enjoyed. I knew what are lamdas but I couldn't stop watching. What a presentation 👌
It is an amazing video. I have never see one teaches computer language like this.
從沒見過有人這樣教程式語言的,讓人驚豔!
"sometimes an extra line is totally fine"
you are great
Lambda functions might be one of my favorite aspects of Python. I love saying “lambda” and there’s a nice connection with the Lambda Calculus. I especially like lambda expressions that return lambda expressions:
poly3 = lambda a,b,c: lambda x:((a*pow(x,2))+(b*x)+c)
So then I got to wondering, what about a function that returns a polynomial of any degree? …
def polyn (coeffs):
poly1 = lambda c,e:lambda x:(c*pow(x,e))
terms = [poly1(c,ix) for ix,c in enumerate(reversed(coeffs))]
return lambda x:[f(x) for f in reversed(terms)]
f1 = polyn([1,0,0]) # x^2
ts = f1(3) # calculate x=3
print(ts) # show the terms
print(sum(ts)) # show the result
Your video inspired me!
Probably the best explanation of Lambda functions I've ever seen, well done.
Every single thing about these videos is awesome! scientific content, sense of humor, directing, art design, makeup, character development, wardrobe...
Wish you made more of these videos ...
This may be the best python tutorials out there.
From my knowledge (before watching this video), lambda is simply the same as creating a function with only one line; the return thingy. For example,
def X(l):
return l[1:] + l[0]
is the same as
X = lambda l: x[1:] + x[0]
My online course just threw a lambda expression at me and this video has done a wonderfully efficient job at catching me up to speed. Much love guys! Thank you! Subscribing and you can bet I'll be perusing that playlist :)
Hooow... did she manage to make this video this funny?
And informative...
Seriously, I'm shook. Bravo, for real for real
this is the highest quality tutorial I've ever seen
"skynet girl".........you are changing the way of teaching .....it feels like we are at some different palace ....keep it up!!!11
This is my first time here....And i just have three words. I LOVE YOU !!!!!!
This video cleared a lot of my doubts related to lambda expressions. Thanks.
"trust me, some people don't know how to use the shift key". This made me shift to the list of your subscribers 🤩
Thanks Socratica I almost forgot my old profession but now am learning python to improve my piracy skills😆😆
Omg I love Socratica so much! Such a refreshing diversion from the normal boring coding tutorials.