[Tutor] multidemisional arrays
Diana Furr
dleigh0 at carolina.rr.com
Sat Nov 13 22:06:26 CET 2004
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20041113/15abb875/attachment.html
More information about the Tutor
mailing list