# List comprehension = A concise way to create lists in Python # Compact and easier to read than traditional loops # [expression for value in iterable if condition] doubles = [x * 2 for x in range(1, 11)] triples = [y * 3 for y in range(1, 11)] squares = [z * z for z in range(1, 11)] fruits = ["apple", "orange", "banana", "coconut"] uppercase_words = [fruit.upper() for fruit in fruits] fruit_chars = [fruit[0] for fruit in fruits] numbers = [1, -2, 3, -4, 5, -6, 8, -7] positive_numbers = [x for x in numbers if x >= 0] negative_numbers = [x for x in numbers if x < 0] even_numbers = [x for x in numbers if x % 2 == 0] odd_numbers = [x for x in numbers if x % 2 == 1] grades = [85, 42, 79, 90, 56, 61, 30] passing_grades = [grade for grade in grades if grade >= 60]
I wonder if bro making these videos, recently . cause after making React tutorials he wants to take some time off. if it is we are all happy that you back. and we hope to learn Next.js from you.
you may confuse fruit (singular) with fruits (plural) if you get error , also you need to use () after fruit.upper() upper = [ fruit.upper() for fruit in fruits]
Maybe he wanted to expand or explain the concepts differently. Maybe he wanted to juice the algorithm for that sweet sweet ad revenue? Maybe my replying to this 6-month-old comment also boosts it? 👍👌
# List comprehension = A concise way to create lists in Python
# Compact and easier to read than traditional loops
# [expression for value in iterable if condition]
doubles = [x * 2 for x in range(1, 11)]
triples = [y * 3 for y in range(1, 11)]
squares = [z * z for z in range(1, 11)]
fruits = ["apple", "orange", "banana", "coconut"]
uppercase_words = [fruit.upper() for fruit in fruits]
fruit_chars = [fruit[0] for fruit in fruits]
numbers = [1, -2, 3, -4, 5, -6, 8, -7]
positive_numbers = [x for x in numbers if x >= 0]
negative_numbers = [x for x in numbers if x < 0]
even_numbers = [x for x in numbers if x % 2 == 0]
odd_numbers = [x for x in numbers if x % 2 == 1]
grades = [85, 42, 79, 90, 56, 61, 30]
passing_grades = [grade for grade in grades if grade >= 60]
This is the best programming channel on UA-cam. Period.
bro once again proves that he makes the best programming content out there
Like the 3rd video I watch about it, and I finally understood it 2 mins in, thanks a lot for being this great!
You are both a good teacher and a good person,
i think that because you got 6000 usd for a good cause!
best tutorial i had ever watched about list comprehensions
true teacher
Love your vids
Thanks mate. Brilliant tutorial
I am from India what a melodious voice u have
Cringe
So Gay
@@Imad_SH are you gay , no problem
But why you write that u are gay
@@ranjeetprasad4586 erm what the sigma
Sit back relax and enjoy
Sir please continue and complete the react course
great tutorial thank you
Bro is great....
Bro Code teaching me more in 10 minutes than my IT teacher teaching me the same material in 2 weeks😭
I wonder if bro making these videos, recently . cause after making React tutorials he wants to take some time off. if it is we are all happy that you back. and we hope to learn Next.js from you.
This dude is the definition of Gigachad
Thanks
Thank the gods for the formula.
Thanks Bro
can u pls mmake a video about numpy arrays
When I try to run the script at 4:54, I keep getting this AttributeError and exit code 1. What happened?
you may confuse fruit (singular) with fruits (plural) if you get error , also you need to use () after fruit.upper()
upper = [ fruit.upper() for fruit in fruits]
loved
pls make a video about explaining grid in css🙏🙏
W video as always
tutoiral on ALL of oop please
why is he redoing these python videos? he already had made a video on list comprehensions
Maybe he wanted to expand or explain the concepts differently. Maybe he wanted to juice the algorithm for that sweet sweet ad revenue? Maybe my replying to this 6-month-old comment also boosts it? 👍👌
150 missed calls from coding schools
Great video, watch it. (like and comment so more people find this video)
You should’ve included “else”
I can just say you are smarter than chat gpt !
third!
nice
How do the fit 2 in the list of odd numbers with List comprehension?