Understanding Python list comprehensions

preview_player
Показать описание
For many newcomers to Python, list comprehensions can be completely confusing. In this video, I explain how you can break comprehensions into three parts (expression - iteration - condition), and thus understand them more easily. Once you understand them, I'd like to think that you'll be more open to using them in your Python development.

Рекомендации по теме
Комментарии
Автор

This is the first time I've understood list comprehensions, that example and breakdown into the 3 separate components really made it so much more understandable! Thanks a lot for this Reuven. As a list comprehension always returns a list, I'm assuming that I can just assign it to a variable if I want to recall it later?

tomkmb
Автор

I just want to say that you're really good at explaining things. Thank you!
Hope you're in good health.

AK-ffgv
Автор

You're the first I see to put list comprehension into multiple lines and because of that now I understand it better!

It really helps make it easier to read, which is awesome!

pietraderdetective
Автор

fantastic episode Reuven, easy to understand and straight to the point especially with the conditional step 😀

KevinBurns
Автор

wah, it's perfectly explained, just an amazing job you've done, thanks for the sharing.

xiaoyangshawnhuang
Автор

The 3.expression, 1.iteration, 2.condition was very useful to organize the syntax - thank you! Any other python coding tips for data science perhaps? 😊

dimitrispavlakis