On 22/10/12 01:09, Dave Angel wrote:

I tried:
for x in zip(a, b, c): print x
But that gives:
('Ron', '25th oct', 'Charms')
('Harry', '27th oct', 'DADA')
('Hermoine', '29th oct', 'Potions')

???

So all you have now is a formatting problem.

Very good;   you're close.  instead of z, just use 3 variables:

for xname, xdate, xitem in zip(a,b,c):
      print xname, "-", xdate
      print xitem

or something similar.

Which could be a format string (Python 2 format since that
looks like what you are using):

for x in zip(a, b, c):
    print "%s - %s\n%s" % x

The advantage of the format string is it gives you much more
control over spacing and justification of the items.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to