Skip to content
Advertisement

Is there a way to combine the following two list comprehensions?

I have a list of “point_objects”, from which I build locx and locy. Please see below. Can these two list comprehensions be brought to just a single line?

JavaScript

Advertisement

Answer

From the title, I understood that you want one line that computes both of these. You can use zip():

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement