"Schüle Daniel" wrote:
> > a = [[] for in range(200)]
>
> correction :)
>
> a = [[] for i in range(200)]
the "*500" part still seems to be missing...
--
http://mail.python.org/mailman/listinfo/python-list
Use nested list comprehensions:
matrix = [[0.0 for x in xrange(n)] for y in xrange(m)]
This is similar to "float matrix[m][n]" in C.
All cells are independent of each other in doing this.
--
http://mail.python.org/mailman/listinfo/python-list
Schüle Daniel schrieb:
> [EMAIL PROTECTED] schrieb:
>> i used C too much and haven't used Python for a while...
>>
>> like in C, if we want an array of array of float, we use
>>
>> float a[200][500];
>>
>> now in Python, seems like we have to do something like
>>
>> a = [ [ ] ] * 200
>>
>> and then
[EMAIL PROTECTED] schrieb:
> i used C too much and haven't used Python for a while...
>
> like in C, if we want an array of array of float, we use
>
> float a[200][500];
>
> now in Python, seems like we have to do something like
>
> a = [ [ ] ] * 200
>
> and then just use
>
> a[1].append(12.3
[EMAIL PROTECTED] wrote:
> i used C too much and haven't used Python for a while...
>
> like in C, if we want an array of array of float, we use
>
> float a[200][500];
>
> now in Python, seems like we have to do something like
>
> a = [ [ ] ] * 200
>
> and then just use
>
> a[1].append(12.34)
[EMAIL PROTECTED] wrote:
> i used C too much and haven't used Python for a while...
>
> like in C, if we want an array of array of float, we use
>
> float a[200][500];
>
> now in Python, seems like we have to do something like
>
> a = [ [ ] ] * 200
>
> and then just use
>
> a[1].append(12.34