Dear Asrarahmed,
I have found the next recipe in the cookbook.
It should be interesting for you :)
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/392153
> Message: 1
> Date: Thu, 05 Oct 2006 10:26:19 -0400
> From: Kent Johnson <[EMAIL PROTECTED]>
> Subject: Re: [Tutor
Asrarahmed Kadri wrote:
> Its something very close.
> What I want is:
>
> 1
> 1 1
> 1 2 1
> 1 3 3 1
> 1 4 6 4 1
>
> This can be done using arrays, right or is there any other way??
Is this a homework assignment?
A list of lists seems like the appropriate way to represent this,
especially sin
Thank you so much.
I am trying to implement. I hope I can do it.
A gentle note: This is not a homework question.
I am learning python as a part of my Project work.
On 10/5/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote:
Asrarahmed Kadri wrote:> Its something very close.> What I want is:>> 1> 1
Asrarahmed Kadri wrote:
> Its something very close.
> What I want is:
>
> 1
> 1 1
> 1 2 1
> 1 3 3 1
> 1 4 6 4 1
>
> This can be done using arrays, right or is there any other way??
They're not arrays, they're lists!
arrays imply contiguous memory blocks and single data types.
Lists are neither
Its something very close.
What I want is:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
This can be done using arrays, right or is there any other way??
My logic in C is:
int arr[5][5];
for (i=0;i<5;i++)
{
flag = 0;
for (j=0;j<=i;j++)
{
if (flag == 0 || j == i) // print 1 if the array element is th
I am stuck.. Please help me with implementing two dimensional array
in Python.
Hi Asrarahmed,
What do you need a two-dimensional array for? This is a serious question:
what's your application? What are you trying to represent, and why?
As a glib possible answer: you can use a di
Asrarahmed,
How about something like this:
>>> arr = []
>>> arr.append(['Blue', 'Yellow', 'Green', 'Brown', 'White'])
>>> arr[0][0]
'Blue'
>>> arr.append(['Up', 'Down', 'Left', 'Right', 'Center'])
>>> arr[1][4]
'Center'
Is this what you were thinking of?
-mtw
On Wed, Oct 04, 2006 at 06:38:09P
Asrarahmed Kadri wrote:
>
> I am looking for something like this:
>
> int arr[5][5]; // C statement; declaring an array of 5 * 5 size
>
> Is there an easy and clean way to achieve this in python???
Can you say something about your use case? If I had to guess I would say
numpy is what you ar
I am looking for something like this:
int arr[5][5]; // C statement; declaring an array of 5 * 5 size
Is there an easy and clean way to achieve this in python???
Thanks
On 10/4/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
Asrarahmed Kadri wrote:>> Hi folks,>> I am stuck.. Please help me wi
Asrarahmed Kadri wrote:
>
> Hi folks,
>
> I am stuck.. Please help me with implementing two dimensional array in
> Python.
Nested lists are the simplest way though beware the gotcha shown here:
http://www.python.org/doc/faq/programming/#how-do-i-create-a-multidimensional-list
You can also use
Asrarahmed Kadri wrote:
>
> Hi folks,
>
> I am stuck.. Please help me with implementing two dimensional array in
> Python.
>
There are no such things as arrays in Python, silly!
I can help you with a two-dimensional list, though :)
Okay, imagine that a list of integers (or any other objects)
Hi folks,
I am stuck.. Please help me with implementing two dimensional array in Python.
Thanks.
-- To HIM you shall return.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
12 matches
Mail list logo