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...
===========================================================
# 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))
man, I am tired of commenting, but I have to keep going cuz u deserve it!
I appreciate that!
true that !
My programming skills are growing faster since I met your channel. You're awesome!
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.
Thanks man, I was so confused as to what lambda functions were in a course I was taking, this cleared it up!
Man, you really got a great talent to explain things in most simplistic way.
Love your videos.
I used to struggled in Python but now I understand clearly because of your video. Keep up the good work
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 👍
Your teaching skill is really awesome. Thanks for the step step explanation. My programming knowledge is also growing fast to watch your videos.
you save my time to understand this lambda function. bro code you're amazing.
Rise and shine mr freeman
so precious !!! thank you so much for sharing!!
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!
I think this might be what you're looking for:
ruclips.net/video/A6sA9KItwpY/видео.html&ab_channel=BroCode
@@BroCodez thanx sir you are awesome
Really like when u write with underscore much readable
Incredible
very helpful,thankuu
bro code is such a good name for this channel lol
Quick and informative. Thanks bro
Thanks 👍😊 Bro. Explanations are always easy to understand
thank you brooh that's my first time see your channel and you help a lot
Love the way explain Bro ❤
Nize chanel
the best explanation I've seen so far, I liked the video and subscribe directly
Half life was so awesome, they made the lambda symbol a real thing!
You are awesome bro💪
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..
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 🙏🏼
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.
👍👍👍
We luv bro
cool and useful tutorial *-*
cool
thx man i really am enjoying your vids
Very clear explanation, thanks.
nice bro
Nice 👍 please explain how to use lambda inside a function Sir
Thank you so much
Great video man, really helpful
Thank you
Its like the difference between function and arrow function in js
Here its function and lambda function
You're awesome man we support you
man all functions should inherit lambdas style: simple and easy
Nicee
I have come this far my master may the force guide me
bro codes the best
Thanks
I
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
@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
@@JamesBond-jp6dp Using f strings are better, print(f"Hello, {var_name}!")
Thanks man!
Awesome Content Keep it up!!! 👍👍👍👍
Great as always
Thanks so much man!
Thanks Bro!
Thank you!
thx 4 vid bro !
Thank you sir!❤❤
helpful video 👍
Thanks for sharing.
Good explanation sir
thank you bro code
Love u❤
love you bro
TY bro
thanks bro
Thank You❤
ty!
Thank you soooooooooooooo much
great as always
you are always great bro
Top Tier Knowledge!
Thanks!
really amazing !!
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!!!
we love you
TY
new for me.. thanks... :)
Λλ lambda aka Greek letter as "Ll"
thank you good sir
tks bro!! it's great
is that half life logo xD ?
yep! lol
done the three steps of bro code
love u
thank you bro😊
well yes, I did learn something knew
bro thanks man thanks
Wow!
Amazing
best bro
HALF LIFE λ
good shit
I asked chatgpt to explain this to me 20 times and I still didnt get it. Now I do
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?
lambda is shorter and faster
Too good
DROP A COMMENT
Bro code? Is lamda function can be used in zip code?
Still very useful in 2023
I know its late but ill drop a comment anyway
lambda is the dark souls shortcut. use it.
based and lambda pilled
The BEst!