map from a list comprehension?
I came across this scraping problem which itself is irrelevant but want to know if it is possible to perform map() from a list comprehension meaning the iterable be a list comprehension?
python list comprehension — two loops with three results?
I can ask my question best by just giving an example. Let’s say I want to use a list comprehension to generate a set of 3-element tuples from two loops, something like this:
Moving corner points of a rectangle in Python: is there a more elegant/compact solution?
I need to move the corner points of a rectangle by a given amount. I’m given an list of 4 3D points, each of which is a list of coordinates ([x,y,z]).
Moving corner points of a rectangle: is there a more elegant/compact solution?
I need to move the corner points of a rectangle by a given amount. I’m given an list of 4 3D points, each of which is a list of coordinates ([x,y,z]).
Is there a way to do this with a list comprehension?
I have a list that looks something like this:
How to Create a List of Duplicates Using List Comprehension in Python?
So briefly, I’m on a python ZTM course, by the one and only Andrei Neagoi, in the Functional programming section precisely, there was this exercise that, required creating a list, that contains the duplicates from another list, instead of using the following for loop:
Use list comprehension with if, else, and for-loop while only keeping list items that meet a condition
I use list comprehension to load only the images from a folder that meet a certain condition.
In the same operation, I would also like to keep track of those that do not meet the condition. This is where I am having trouble.
Coursera Python – Use list comprehension to create a list called lst2 that doubles each element in the list, lst
So, I got this question on Coursera’s Python course through Runestone Academy:
temporary variable in list comprehension
Is there a concise way to rewrite the following code fragment as a list comprehension?
How to improve a List Comprehension in python
I’m attempting to convert this function to a List Comprehension but I have to do a work around using set() to prevent False from repeating. And the locations are not in order. e.g. {0, 12, 5} instead of [0, 5, 12]. Can someone advise where I’m going wrong?