Writen by
Chai Biscuit
1:16 PM
-
0
Comments
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.
Example:
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:
💕
No comments
Post a Comment