tldr # list comprehension = a way to create a new list with less syntax # can mimic certain lambda functions, easier to read # list = [expression for item in iterable] # list = [expression for item in iterable if conditional] # list = [expression if/else for item in iterable] # -------------------------------------------------------------- squares = [] # create an empty list for i in range(1,11): # create a for loop squares.append(i * i) # define what each loop iteration should do print(squares) # create a list AND defines what each loop iteration should do squares = [i * i for i in range(1,11)] print(squares) # -------------------------------------------------------------- students = [100,90,80,70,60,50,40,30,0] passed_students = list(filter(lambda x: x >= 60, students)) passed_students = [i for i in students if i >= 60] # passed_students = [i if i >= 60 else "FAILED" for i in students] print(passed_students) # --------------------------------------------------------------
I like how you have around 83k in the first video of the series and on this you have only around 4k, I won't give up like others Im going to stay here till I learn this complete.
Dear bro, I love your vids but is there any chance that you can add like 5 exercises at the end of your video for every topic you do, maybe a link to github rep will do. thaanks
tldr
# list comprehension = a way to create a new list with less syntax
# can mimic certain lambda functions, easier to read
# list = [expression for item in iterable]
# list = [expression for item in iterable if conditional]
# list = [expression if/else for item in iterable]
# --------------------------------------------------------------
squares = [] # create an empty list
for i in range(1,11): # create a for loop
squares.append(i * i) # define what each loop iteration should do
print(squares)
# create a list AND defines what each loop iteration should do
squares = [i * i for i in range(1,11)]
print(squares)
# --------------------------------------------------------------
students = [100,90,80,70,60,50,40,30,0]
passed_students = list(filter(lambda x: x >= 60, students))
passed_students = [i for i in students if i >= 60]
# passed_students = [i if i >= 60 else "FAILED" for i in students]
print(passed_students)
# --------------------------------------------------------------
I like how you have around 83k in the first video of the series and on this you have only around 4k, I won't give up like others Im going to stay here till I learn this complete.
4 Months later hope you stayed consistend!
@@jasonunterwegs8991 i did
@@ombrenombre7496 glad to hear that! best luck for the next 4 months
one year later, hopefully you're still consistent
Same with me!
Always the best method for learning❤❤
I'll never let this channel die😭
Straight to the point. Great content 👌
Excellent content bro!
Beating the algorithm for you :-)
very nice video
Excellent tutorial. Tq. Subbed.
thanks for sharing code in comments, very useful
dude much love for you
🐐
Thanks for every thing
good video
thx 4 vid bro ~!
I liked I commented I subscribed months ago, I hope i keep this channel running :)
i like this
Love it, thanks bro!
Genio total!! Thank you very much!
excellent
Thanks Bro
Wow!
Thank you! Very useful
Question: Can you actually put an elif statement into a list comprehension?
Your videos help me a lot btw, thank you so much!
Ty Bro
Takes a bit of getting used to, but worth trying
@every thing yo just asking how are you doing in python after 3 months? hope you do good m8
another perfect video
lovw u
Thank you!
Thanks
support
thanks
Who else if learning to code as a beginner?
thanks.
thanks :)
Dear bro, I love your vids but is there any chance that you can add like 5 exercises at the end of your video for every topic you do, maybe a link to github rep will do. thaanks
Great job, but how about one that has compound comprehensions?
meow~!
algorithm comment
Just an comment
YALLA
bro code can make me come
comment
List comprehension is cool, dict comprehension is shi
thanks