[Tutor] Print items from 3 lists in order

Saad Javed sbjaved at gmail.com
Mon Oct 22 02:01:07 CEST 2012

a = ['Ron', 'Harry', 'Hermoine']
b = ['25th oct', '27th oct', '29th oct']
c = ['Charms', 'DADA', 'Potions']
I want to print like this:
Ron - 25th oct
Harry - 27th oct
Hermoine - 29th oct

The items in each list are populated dynamically so I don't know how many
items will be there in each list, every time the program runs.
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')


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121022/65499631/attachment.html>

More information about the Tutor mailing list