Five Examples of Using List Comprehensions in Python

List Comprehensions in Python are awesome. A while back wrote a post on some examples of using List Comprehensions in Python. Here are more examples of List Comprehensions 1. Converting a list of integers to a list of strings Let us say we have a list of integers like and we can use List Comprehensions […]

Three Ways to Merge (or flatten) Lists in Python

Often you may have to flatten a list of lists or merge multiple lists into a single list in python. Obviously there are multiple ways to go about it. Here are three ways to flatten or merge lists in to a list. Merge with “+” Operator” If you have three separate lists like [1, 2, […]

Mastering Lists in Python Using List Comprehensions

Ever faced the problem of creating a unique lists in Python? or Accessing only specific elements of lists in Python? Python’s “List Comprehensions” offers you the immense power to create and use lists. Here is a brief introduction to understand and getting started on using List Comprehensions in Python. Python’s List Comprehensions Example 1 The […]