What is list comprehension? Give an example.



What is list comprehension? Give an example...

Answer / nashiinformaticssolutions

A syntax component called list comprehension makes it easier to create a list using an existing iterable.

For instance:


[i for i in range(1, 10)] = my_list

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

What is python coverage?

0 Answers  


How to write a text from from another text file in python ?

0 Answers  


How many data types are there in python?

0 Answers  


How do you convert a string to in python?

0 Answers  


Is python a shell script?

0 Answers  






How to install a package and import?

0 Answers  


Tell me how do you debug a program in python? Is it possible to step through python code?

0 Answers  


What is the difference between lists and tuples?

0 Answers  


Explain split() and join() function.

0 Answers  


Explain all the file processing modes supported by python?

0 Answers  


Which is better python or r?

0 Answers  


What is multithreading? Give an example?

0 Answers  


Categories