K
Kenny
Hello,
I wanted a list with unique element at postion zero, so I wrote a little
code that I thought would do this (see below).
.... x=random.random()
.... print x
.... a[0]=str(x*10)
....
0.710829738051
0.896195451411
0.0971075321793
0.882219628625
[['8.82219628625', 'c', 'd'], ['8.82219628625', 'c', 'd'],
['8.82219628625', 'c', 'd'], ['8.82219628625', 'c', 'd']]
Can someone explain why all the position zeros are being assigned the same
value of x?
List a was generated previously as
Regards,
Kenny
*******************************************************************************
tout casse, tout passe, tout lasse.
*******************************************************************************
I wanted a list with unique element at postion zero, so I wrote a little
code that I thought would do this (see below).
.... x=random.random()
.... print x
.... a[0]=str(x*10)
....
0.710829738051
0.896195451411
0.0971075321793
0.882219628625
[['8.82219628625', 'c', 'd'], ['8.82219628625', 'c', 'd'],
['8.82219628625', 'c', 'd'], ['8.82219628625', 'c', 'd']]
Can someone explain why all the position zeros are being assigned the same
value of x?
List a was generated previously as
.... a.append(b)a=[]
b=['t','c','d']
for i in range(5):
Regards,
Kenny
*******************************************************************************
tout casse, tout passe, tout lasse.
*******************************************************************************