In this Python tutorial you will learn about List Comprehension.
List comprehension provides an alternative way to create lists in a single line of code rather than the standard way of creating an empty list and appending element by element in a for loop.
This tutorial is an extension of Python Lists. If you want to master Python List data type you should check the following tutorial videos:
1. List Introduction: • Beginner Python Tutorial #6 - Introdu...
2. Lists Methods: • Beginner Python Tutorial # 7 - Lists ...
Playlist: Intermediate Python Tutorials | Video #5
Access the code here: https://github.com/rscorrea1/youtube.git
Timestamp:
0:00 - Start of the video
0:40 - Populate lists with for loops
1:27 - List comprehension: General Form
5:47 - List comprehension with nested for loop
9:08 - Exercise: Build a polar grid with list comprehension
9:23 - Wrapping up
Thumbnail:
Photo by Mario Ho on Unsplash