[Tutor] multidemisional arrays
Bill Mill
bill.mill at gmail.com
Sat Nov 13 22:36:49 CET 2004
Diana,
The tutorial's section on output formatting might help you out:
http://docs.python.org/tut/node9.html#SECTION009100000000000000000
Peace
Bill Mill
bill.mill at gmail.com
On Sat, 13 Nov 2004 16:06:26 -0500, Diana Furr <dleigh0 at carolina.rr.com> wrote:
>
> Please someone help me. I don't know where else to look. I have tried
> everything I've seen to get this to work right but I must be doing something
> wrong.
> This is the program:
>
> i=0
> howMany=input('How many artists will you enter? ')
> paintings=[]#painting
> artists=[]#artist
> values=[]#value
> for i in range(0,howMany,1):
> painting=raw_input('Painting Name ')
> artist=raw_input('Artist Name ')
> value=input('Painting Value ')
> paintings+=[painting]
> artists+=[artist]
> values+=[value]
> artists=zip(artists,paintings,values)
> artists.sort()
> i=i+1
> n=0
> for n in range(0,howMany,1):
> print artists[n]
>
> I need the program to sort the artists alphabetically. I can do that but I'm
> having trouble with the other lists. When I print it needs to look like
> this:
> Artist Painting Value
> Alecia Flowers 10
> Diana Apples 15
>
> When I print it looks like this:
> ('Alecia', 'Flowers', 10)
> (('Diana', 'Apples', 15), 'Apples', 15)
>
> Why does the , 'Apples', 15) print and how can I loose the parenthesis and
> quotation marks.
> Thanks in advance.
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
>
More information about the Tutor
mailing list