Рет қаралды 186,633
In this tutorial, we will learn all about list comprehensions and how they can make our Python journey much easier and much more efficient!! 🤓🤓🤓
List comprehensions provide a shorter and faster alternative to "for" loops (especially when combined with conditional statements as well as append commands). And best of all - it takes only 1 LINE OF CODE! 😱
This video offers 3 separate coding exercises, various examples and colorful illustrations of the concepts involved. Please feel free to use my code and artwork, you can find it in the link below:
⭐⭐ clone my code: ⭐⭐
* Sorry code is unavailable, RIP Wayscript 😭😭😭*
And on a festive note...
🍁HAPPY CANADA DAY!!!🍁
to all my fellow Canadians! (and other Earth dwellers who celebrate 😉)
Sending you lots of love from beautiful British Columbia! 💗💗💗
⏰ time stamps ⏰
____________________
00:00 - intro
00:17 - what is a list comprehension?
01:22 - for loop vs list comprehension
02:40 - coding example
06:07 - conditional list comprehension
06:27 - coding example 2
09:02 - list comprehension on strings
09:29 - coding example 3
12:09 - else if list comprehension
13:50 - coming soon: dictionary comprehension
14:12 - thanks for watching!
🐍🐍 related tutorials of mine 🐍🐍
_____________________________________
- For Loops:
• Python For Loops - Pro...
➡️➡️ starter code ⬅️⬅️
__________________________
fruits = ["apples", "bananas", "strawberries"]
for fruit in fruits:
print(fruit)
💳💳 credits 💳💳
_______________________
- Beautiful Icons are by:
www.flaticon.com/
- Beautiful Like/Share/Subscribe video graphics by:
mixkit.co/
🤝 connect with me 🤝
_______________________
- Github: github.com/MariyaSha
- Discord: / discord
- LinkedIn: / mariyasha888
- Twitter: / mariyasha888
- Blog: pythonsimplified.ca