For example:
for y,x in zip(range(0,4,1),range(0,8,2)): print(x+y)
Returns:
0 3 6 9
What I want is:
['0', '3', '6', '9']
How can I achieve this?
The easiest way for your understanding, without using list comprehension, is:
mylist = [] for y,x in zip(range(0,4,1),range(0,8,2)): mylist.append(str(x+y)) print mylist
Output:
['0','3','6','9']
2.1m questions
2.1m answers
60 comments
57.0k users