📚 Python 3 Crash Course e-Book: https://ebooks.fabiopacifici.com/python/
🙌 Buy me a cup of tea: https://www.paypal.me/FabioHood
🛒 Development Services: https://fabiopacifici.com/shop/
🤟 Channel Merchandise: https://teespring.com/en-GB/stores/pa...
📌 Blog: https://fabiopacifici.com/blog/
Now that we covered conditionals and loops in the previous videos we can talk about list comprehensions. A list comprention is a shortcut to create lists where each element is the result of an operation. A list comprehensions uses for loops and if clouses to create a new list, therefore, we had to learn about loops and conditional first.
In this episode:
00:00 | Introduction to List Comprehensions
00:38 | How to define a list comprehension
01:22 | Example with single for loop
08:05 | Example with conditionals
15:32 | Example using functions
18:25 | Example getting the output as a tuple with multiple elements
22:18 | Example with methods
26:30 | Example with multiple loops
29:10 | Example with nested lists
Find out more:
https://docs.python.org/3/tutorial/da...