Latest News

Wednesday, May 26, 2021

What is List Comprehension and Hacker Rank solution

 What is List Comprehension?

List comprehensions are a quick and easy way to make lists It  is one of Python's most important features. List comprehensions are used for creating new lists from other iterable, or to create a subsequence of those elements that satisfy a certain condition.


We want a list that will have all characters of a string . Using List comprehension we can write as below:

We can solve the same problem using the traditional way as below:

Hacker Rank Problem:

Hacker Rank Solution:


  • Google+
  • Pinterest

No comments

Post a Comment