I think i got it....
i m creating a tuple of 2 elements everytime and i m adding it to a list. i
m creating a new tup everytime and adding it to a list....
for x in file:
value=0
tup = ()
for developerAgent in developers:
#print developerAgent.disutility
value +=developerAgent.disutility
tup = (value,globalVar.cntr)
globalVar.cntr +=1
globalVar.disutilList.append(tup)
print globalVar.disutilList
i am getting output as what i described...
thanks for the help :)
On Mon, Feb 25, 2008 at 6:52 PM, Kent Johnson <[EMAIL PROTECTED]> wrote:
> 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
>
--
Varsha Purohit,
Graduate Student
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor