May-03-2019, 02:44 PM
(This post was last modified: May-03-2019, 02:44 PM by python_user_n.)
(May-03-2019, 02:38 PM)Gribouillis Wrote:Quote:If there another way to create a list of tuples beside zip()?There are many ways. One of them is list comprehension
>>> [(i, i+1, i+2) for i in range(5)] [(0, 1, 2), (1, 2, 3), (2, 3, 4), (3, 4, 5), (4, 5, 6)]
Very concise method for creating list of values.
And if I need to combine already pre-existing values from one list/tuples to another list of tuples?
Thanks.