Varsha Purohit wrote: > Hello all, > In my application i have to create a list of tuples. I have a for > loop which will create (x,y) tuple each time it iterates, and i ahve to > store each tuple in a list like > > list1= [(x1,y1), (x2,y2).....] > > any ideas how to do that ???
list1 = [] for ... # code to create x and y list1.append( (x, y) ) Note you do need the double parentheses; the inner pair creates a tuple, the outer pair is for the function call. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor