In this Python Programming video tutorial you will learn about List comprehension in detail with example.
List is nothing but “it is the group of different types of elements”.And there are different ways to create list in Python, but one of the easiest, fastest and elegant way is using list comprehension.
List Comprehension is the perfect substitute for lambda map filter and reduce function . If you are not comfortable with the syntax of those function then you can use list comprehension instead of them.
For more free tutorials on computer programming
Nguồn: https://benjaminjcohen.com/
Xem thêm bài viết khác: https://benjaminjcohen.com/cong-nghe/
madam, please explain below code how the answer is getting '1'
values = [[3, 4, 5, 1], [33, 6, 1, 2]]
v = values[0][0]
for lst in values:
for element in lst:
if v > element:
v = element
print(v)
Subscribed mam
Hi mam,
I have a doubt
for i in range(1,6):
Print(i , end = ' ')
Output will be 1 2 3 4 5
I want output to be printed in an array like [1,2,3,4,5]
Please explain this
Thanks for your response
How can we print 1 to 10 numbers with out using loops
How could you say that list comprehension is faster then loop give me the proper explanation