Re: [Tutor] Request for help learning the right way to deal with listsin lists

2010-07-15 Thread Christopher King
I will spilt it up and add comments. Books =\ #Assign to Books [Book('War & Peace", [3, 56, 88]), #The first is a Book named 'War & Peace' Book("Huck Finn", [2, 5, 19])] #You use the book class twice in a row, one for each book On Thu, Jul 15, 2010 at 8:09 AM, Payal wrote: > On Tue, Jul 13, 201

Re: [Tutor] Request for help learning the right way to deal with listsin lists

2010-07-15 Thread Payal
On Tue, Jul 13, 2010 at 08:35:45AM +0100, Alan Gauld wrote: > If the data gets more complex you could put the data into a class: > > class Book: > def __init__(self, title, pages=[]): > self.title = title > self.pages = pages > > Books = [ Book('War & Peace", [3,56,88]), >

Re: [Tutor] Request for help learning the right way to deal with listsin lists

2010-07-13 Thread Alan Gauld
"Siren Saren" wrote say I have a list that's a composite of two elements: books and key pages / albums and favorite tracks / medicines and times taken, whatever. Thats a good scenario for using a dictionary containing a list or tuple per key. To make a program that does something to the fir