Python lambda λ

preview_player
Показать описание
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 👟 :
===========================================================
===========================================================

music credits 🎼 :
===========================================================
Creative Commons — Attribution-ShareAlike 3.0 Unported— CC BY-SA 3.0
===========================================================
Рекомендации по теме
Комментарии
Автор

# 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))

BroCodez
Автор

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

raedrnp
Автор

Thank bro, this is so different than other video explaining how lambda works

Lons_Tran
Автор

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

Amir_Plays_non_stop
Автор

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

Love your videos.

markost.
Автор

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.

pchan
Автор

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

split
Автор

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

_three
Автор

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

xx
Автор

Really like when u write with underscore much readable

ievgendergausov
Автор

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

mehedihasaniqbal
Автор

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

maxdonify
Автор

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

dj_arimakousei
Автор

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 👍

mohammadnoori
Автор

bro code is such a good name for this channel lol

berryberry
Автор

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

The_Black_