How to implement multi-dimensional arrays in Python??

Reply

Join Date: Aug 2006
Posts: 6
Reputation: akadri is an unknown quantity at this point 
Solved Threads: 1
akadri's Avatar
akadri akadri is offline Offline
Newbie Poster

How to implement multi-dimensional arrays in Python??

 
0
  #1
Sep 5th, 2006
Does anyone have an idea about implementing two dimensional arrays in Python??

I want to write two programs:
(1) a program for matrix multiplication
(2) a program for displaying Pascal's triangle.

Both these programs require two dimensional array..? Or is there any other way to solve this..
Thanks in anticipation..

Regards,
A Kadri
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 148
Reputation: Micko is on a distinguished road 
Solved Threads: 6
Micko Micko is offline Offline
Junior Poster

Re: How to implement multi-dimensional arrays in Python??

 
0
  #2
Sep 6th, 2006
You can define matrix using list:
  1. matrix = [[1,2,3],[4,5,6],[7,8,9]]
  2.  
  3. print matrix[0][1]


As for multiplication program and Pascal's triangle, you'll need to show some effort. Matrix is not needed for displaying Pascal's triangle
Last edited by Micko; Sep 6th, 2006 at 2:07 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 1,221
Reputation: bumsfeld will become famous soon enough bumsfeld will become famous soon enough 
Solved Threads: 137
bumsfeld's Avatar
bumsfeld bumsfeld is offline Offline
Nearly a Posting Virtuoso

Re: How to implement multi-dimensional arrays in Python??

 
0
  #3
Sep 7th, 2006
There are modules like numpy, that do high speed array and matrix manipulations. Google for numpy, its free.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 608
Reputation: jrcagle is on a distinguished road 
Solved Threads: 150
jrcagle jrcagle is offline Offline
Practically a Master Poster

Re: How to implement multi-dimensional arrays in Python??

 
0
  #4
Sep 16th, 2006
Pascal's triangle is most easily done using recursion, IMO.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC