[Tutor] Python help
To whom it may concern, I am having a problem solving the below question. I have used every resource that I could find to help me, but I'm seeing nothing. Can someone out there please help me understand the below question and learn how to accomplish this task in Python? I would really appreciate any help that someone could afford. *Problem 1:* Write a program that will calculate the problem and stop after the condition has been met. a=number of loops (start with zero) b=a+1 c=a+b Condition: If c is less than 5, then the loop will continue; else, it will end. 3. *Problem 2:*Print a string variable that states the number of loops required to meet the condition for Problem 1. My attempt below. I used a while loop even though the question is saying IF/THEN/ELSE. To my knowledge loops in Python have to be while/for. Also, it seems like the question is missing some direction, but I could be wrong. Thank you for your help. a = 0 b = a + 1 c = a + b while (c < 5): print(c) c = c + 1 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Python help
On 13/08/15 02:01, IDN3 wrote: To whom it may concern, I am having a problem solving the below question. I have used every resource that I could find to help me, but I'm seeing nothing. Can someone out there please help me understand the below question and learn how to accomplish this task in Python? I would really appreciate any help that someone could afford. OK, We won;t give you the solution but we can certainly help you understand the question and point you in the right direction. *Problem 1:* Write a program that will calculate the problem and stop after the condition has been met. a=number of loops (start with zero) b=a+1 c=a+b Notice that a is the thing that counts the number of loops. So you need to increment a inside your loop. b and c are based on a. Condition: If c is less than 5, then the loop will continue; else, it will end. 3. *Problem 2:*Print a string variable that states the number of loops required to meet the condition for Problem 1. This is a simple bit of math. You don't need to run the loop to figure out the answer, just write an equation. My attempt below. I used a while loop even though the question is saying IF/THEN/ELSE. You obviously did not send the whole question. I don't see any mention of if/then/else? To my knowledge loops in Python have to be while/for. Also, it seems like the question is missing some direction, but I could be wrong. The two questions are both OK, but i think you missed the bit that said a was the variable that counted the number of times round the loop. This is a little bit unusual since normally your while loop test uses the counting variable (ie. a) but in this case it uses c which is based on a. But it does demonstrate that the while condition can be more complex that the basic form. a = 0 b = a + 1 c = a + b while (c < 5): print(c) c = c + 1 You need to make a the counter and not c. You need to recalculate c after changing a. You need to print the number of loops (a) not c. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Python help
On 13Aug2015 10:34, ALAN GAULD wrote: On 13/08/15 02:01, IDN3 wrote: [...snip...] Condition: If c is less than 5, then the loop will continue; else, it will end. 3. *Problem 2:*Print a string variable that states the number of loops required to meet the condition for Problem 1. This is a simple bit of math. You don't need to run the loop to figure out the answer, just write an equation. Maybe so, but for an arbitrarily weird condition running the loop may be the way to go. Therefore I would imagine he is being asked to print how many times that loop ran. So he should just print that value after the loop finishes (i.e outside the loop). My attempt below. I used a while loop even though the question is saying IF/THEN/ELSE. You obviously did not send the whole question. I don't see any mention of if/then/else? Actually, the question's "Condition:" section is written in exactly those terms. To my knowledge loops in Python have to be while/for. Also, it seems like the question is missing some direction, but I could be wrong. The way I would read your "Cndition:" requirement is that it is describing what kind of decision must be made every time the loop commences. It is not telling you to use Pythons "if" statement. So just putting the correct condition at the top of the "while" loop is what you want. Cheers, Cameron Simpson If you lie to the compiler, it will get its revenge.- Henry Spencer ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Python help
On 13/08/15 10:44, Cameron Simpson wrote: You obviously did not send the whole question. I don't see any mention of if/then/else? Actually, the question's "Condition:" section is written in exactly those terms. Oops, so it is. My bad. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] How to effectively use a Student class with SQLite [Was Re: How to design object interactions with an SQLite db?]
Beware! Lengthy post!! Sign of a confused boB. ~(:>) I believe that I understand now all of the things I want my project (Tentatively named "Montessori Classroom Manager".) to *do*. But I am currently spinning my wheels on how to implement classes, SQLite, and the kivy UI, so that they all effectively interact with each other. I think it is time to write some code and that I should start with the most fundamental class to the project, the Student class. The Student class, as I now envisage it, will have many attributes, which seem to naturally map to a Student db table. The first issue that I am puzzling over is the very real possibility of duplicate student names. Of course, I was planning on the Student db table having a primary key of student_id, which would be an unique identifier for a particular student. The problem with this is from the user's perspective: The teacher will naturally want to interact with the program using the student's name, possibly even a student's nickname. These can be non-unique. I like Alan's suggestion: On Sat, Aug 1, 2015 at 12:30 PM, Alan Gauld wrote: > On 01/08/15 17:34, boB Stepp wrote: >> 1) Create my various objects normally, but have their data attributes > >> fetched through some sort of db manager class I would design. > > Personally I tend to create a load() method that is used like a constructor > but fetches the data from the database > > myObj = MyClass().load(ID) > > Where load() returns self if successful. > Alternatively in Python you could define the ID as a parameter of init with > a None default > > def __init__(self,att1=None,att2=SomeDefault,...,ID=None): > if ID >self.load(ID) > else: >self.att1 = att1 # etc... > > Its conceptually simple and gives you full control of the SQL, but things > like inheritance can get tricky. Both his ideas rely on using the primary key for a student to fetch the information needed to create that particular student object, which the user will not normally ever use directly. So this leads me naturally to the UI design, something I would normally mostly forget about until I had my main program logic well worked out. But in this project it seems to me that program logic, db and UI are all intimately intertwined. In terms of UI I imagine the user will have some sort of list of student names displayed. In a given school year in the case of two students with identical names, I imagine the target user (my wife) will want a student nickname displayed to differentiate between two (or more) such students. So she would select a student in the UI and start doing stuff. I assume if I have a list of student names in the UI, then the program already created all of the student objects in the list, so the student_id primary key for each student would be freely available to use. However, if the student did not exist in the list, then a new student object would have to be created and its relevant attributes recorded in the student db table with its newly created student_id primary key. So (Finally!) if I am understanding the important issues involved in creating a viable Student class, I should be doing: 1) For the current school year, at program startup, the program should retrieve all current students' attributes from the db, instantiate each such student object, and be able to make each available in the UI. 2) If a new student needs to be created by the user, then the Student class would have an appropriate method which would allow for data entry via the UI to both create a new student object and a new student db table entry with its own unique student_id primary key. 3) The program logic would reference each student object only with the student_id primary key uniquely associated with each such student object. Is this the way to approach this, or at least a good way? I don't want to worry about actually coding the UI at this point, but it looks like while testing things as I go along, I will need to have at least a text simulation of a UI, so I can try selecting students, creating students, etc. Would the best way to go about this is to create an old command line-style menu system, which lists options by number, input number desired, action occurs etc.? As always, many thanks in advance! boB ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How to effectively use a Student class with SQLite [Was Re: How to design object interactions with an SQLite db?]
On 13/08/15 20:18, boB Stepp wrote: that I am puzzling over is the very real possibility of duplicate student names. Of course, I was planning on the Student db table having a primary key of student_id, which would be an unique identifier for a particular student. The problem with this is from the user's perspective: The teacher will naturally want to interact with the program using the student's name, possibly even a student's nickname. These can be non-unique. Yes, that's a standard problem in any HR type application. Names suck as database keys. But names are how humans interact. The only way around it that I know is for you to assign and use student IDs in the code but on the UI use search screens that 90%+ return one student but occasionally return 2 or 3 (rarely many more) and the user has to figure out which one they want.. If you have a search form you have to check for multiple responses before filling the form. If its true then pop up a list dialog to let the user pick. (One nice feature if you are likely to doing a lot with one student is to provide a "sticky flag" that remembers the choice for all future queries in that session - you need a reset option somewhere too of course or the user has to quit the system and restart!) But many colleges now issue student cards with a unique ID. So the problem may not be as hard as you think. So this leads me naturally to the UI design, something I would normally mostly forget about until I had my main program logic well worked out. But in this project it seems to me that program logic, db and UI are all intimately intertwined. Hopefully not, you can create a web/desktop or CLI UI. The UI (or specifically the Controller in MVC terms) may well dictate or at least influence the API to the data (or Model in MVC terminology.) The display (View in MVC) part of the UI should typically be driven by the API rather than the other way round. The other thing that can really help is to use the Use Case methodology. Write out the interaction dialog between user and system for the "happy path" scenario for a given task. Then analyse each step in turn for potential error cases and write out the use case for how you'd handle each error type. There is a ton of Use case material online. It's a very powerful technique and since its text based, there's no new tools to learn. I've used it on everything from small personal projects to multi-million dollar projects with hundreds of programmers. As a free side-effect you get free test scripts too. In terms of UI I imagine the user will have some sort of list of student names displayed. In a given school year in the case of two students with identical names, I imagine the target user (my wife) will want a student nickname displayed to differentiate between two (or more) such students. So she would select a student in the UI and start doing stuff. Yep, that's usually how it works. The class or year or age could also be choice differentiators too) I assume if I have a list of student names in the UI, then the program already created all of the student objects in the list, so the student_id primary key for each student would be freely available to use. However, if the student did not exist in the list, then a new student object would have to be created and its relevant attributes recorded in the student db table with its newly created student_id primary key. Yes. The "happy path" use case is only one student returned. The first error case is multiple students including an identifiable target. The second error case is no identified target. You are already beginning to think like a use case approach, the technique just formalises it and so forces you to uncover errors you might otherwise miss. So (Finally!) if I am understanding the important issues involved in creating a viable Student class, I should be doing: 1) For the current school year, at program startup, the program should retrieve all current students' attributes from the db, instantiate each such student object, and be able to make each available in the UI. Maybe not. You could have a report object that displays a subset of student attributes without creating an object per student. Then only when it comes time to modify or operate on a student in some way do you need to instantiate the student object with its associated data and methods (don't forget in OOP its the methods that are important, the data is the support act.) If you only want to view data you probably want a Report (or Query if you prefer - but I prefer to name objects after the output. The query is part of the constructor and other methods of the record - refresh, filter, etc) rather than an object per record. 2) If a new student needs to be created by the user, then the Student class would have an appropriate method which would allow for data entry via the UI to both create a new student object and a new student db table entry with its own unique studen
[Tutor] Searching through files for values
Hi, I'm trying to search for list values in a set of files. The goal is to generate a list of lists that can later be sorted. I can only get a match on the first value in the list: contents of value_file: value1 value2 value3 ... The desired output is: file1 value1 file1 value2 file2 value3 file3 value1 ... Bit it's only matching on the first item in vals, so the result is: file1 value1 file3 value1 The subsequent values are not searched. filenames = [list populated with filenames in a dir tree] vals = [] value_file = open(vars) for i in value_file: vals.append(i.strip()) value_file.close() for file_list in filenames: with open(file_list) as files: for items in vals: for line in files: if items in line: print file_list, line for line in vals: print line returns: ['value1', 'value2', 'value3'] print filenames returns: ['file1', 'file2', 'file3'] Any help would be greatly appreciated. Thanks, Jason ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How to effectively use a Student class with SQLite [Was Re: How to design object interactions with an SQLite db?]
Whew, Alan! You've given me quite a lot to mull over. Thank you very much for the time you've invested in your responses!! On Thu, Aug 13, 2015 at 6:38 PM, Alan Gauld wrote: > On 13/08/15 20:18, boB Stepp wrote: > [...] > Yes, that's a standard problem in any HR type application. Names suck as > database keys. But names are how humans interact. HR = Human Resources? > > The only way around it that I know is for you to assign and use > student IDs in the code but on the UI use search screens that > 90%+ return one student but occasionally return 2 or 3 (rarely > many more) and the user has to figure out which one they want.. I've had this rattling around in my brain when I sent my post. > If you have a search form you have to check for multiple responses before > filling the form. If its true then pop up a list dialog > to let the user pick... It looks like I would need to query the db for all students with this same name, and display enough additional info for each student to enable the user to select the correct one? And once that selection is made I would have the student_id needed to pull info out of the db? It looks like there may be an edge case problem that can slip through the cracks: As the user will be doing her own student data entry, in the case of students with duplicate names, she might forget to enter one (or more, if there are that many). The program would return only one name, suggesting no name duplication exists, and might cause the user to start editing that student's info when she really needs to do is create the student entry which she forgot to do so in the first place and edit that student's data. It seems that I would always have to display a certain amount of student information to make it *obvious* to the user which student she is editing. Or is there an easier way? > > But many colleges now issue student cards with a unique ID. So the problem > may not be as hard as you think. My wife is dealing with 7th through 9th graders, not college level. Her school does not assign student id numbers, so I would have to have the program generate unique ids numbers. >> So this leads me naturally to the UI design, something I would >> normally mostly forget about until I had my main program logic well >> worked out. But in this project it seems to me that program logic, db >> and UI are all intimately intertwined. > > > Hopefully not, you can create a web/desktop or CLI UI. > The UI (or specifically the Controller in MVC terms)... I'm guessing this stands for "Model-view-controller" as in https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller > ...may well dictate or at least influence the API to the > data (or Model in MVC terminology.) The display (View in MVC) > part of the UI should typically be driven by the API rather > than the other way round. I may be getting bogged down in terminology here. In this MVC design, is the controller serving as the API between the data (model) and the display (view)? So is the idea here to decouple the program logic from the (possibly complicated) UI, is to have a module (controller?) which processes data resulting from the program logic (model) and then decides whether this should go to the menu portion of the display, or the part that generates a pop-up window, etc.? And likewise user-generated events go to the controller module and it decides which data states get altered in the model? And IF I am understanding this correctly, the program logic (model) and controller need to be designed in parallel? > > The other thing that can really help is to use the Use > Case methodology. Write out the interaction dialog between > user and system for the "happy path" scenario for a given task. > Then analyse each step in turn for potential error cases and > write out the use case for how you'd handle each error type. > There is a ton of Use case material online. It's a very powerful technique > and since its text based, there's no new tools to learn. This is new to me, but I have always tried to think along these broad lines in other projects I have done. I will have to search for most applicable materials to my current project. >> So (Finally!) if I am understanding the important issues involved in >> creating a viable Student class, I should be doing: >> >> 1) For the current school year, at program startup, the program >> should retrieve all current students' attributes from the db, >> instantiate each such student object, and be able to make each >> available in the UI. > > > Maybe not. You could have a report object that displays a subset > of student attributes without creating an object per student. > Then only when it comes time to modify or operate on a student > in some way do you need to instantiate the student object with > its associated data and methods (don't forget in OOP its the > methods that are important, the data is the support act.) > If you only want to view data you probably want a Report
Re: [Tutor] Searching through files for values
On 13Aug2015 16:48, Jason Brown wrote: I'm trying to search for list values in a set of files. The goal is to generate a list of lists that can later be sorted. I can only get a match on the first value in the list: contents of value_file: value1 value2 value3 ... The desired output is: file1 value1 file1 value2 file2 value3 file3 value1 ... Bit it's only matching on the first item in vals, so the result is: file1 value1 file3 value1 The subsequent values are not searched. Rhat is because the subsequent values are never loaded: filenames = [list populated with filenames in a dir tree] vals = [] value_file = open(vars) for i in value_file: vals.append(i.strip()) value_file.close() You close value_file inside the loop i.e. immediately after the first value. Because the file is closed, the loop iteration stops. You need to close it outside the loop (after all the values have been loaded): value_file = open(vars) for i in value_file: vals.append(i.strip()) value_file.close() It is worth noting that a better way to write this is: with open(vars) as value_file: for i in value_file: vals.append(i.strip()) Notice that there is no .close(). The "with" construct is the pynthon syntax to use a context manager, and "open(vars)" returns an open file, which is also a context manager. A context manager has enter and exit actions which fire unconditionally at the start and end of the "with", even if the with is exited with an exception or a control like "return" or "break". The benefit of this is after the "with", the file will _always" get closed. It is also shorter and easier to read. for file_list in filenames: with open(file_list) as files: for items in vals: for line in files: if items in line: print file_list, line I would remark that "file_list" is not a great variable name. Many people would read it as implying that its value is a list. Personally I would have just called it "filename", the singular of your "filenames". Cheers, Cameron Simpson ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How to effectively use a Student class with SQLite [Was Re: How to design object interactions with an SQLite db?]
If your students need to provide a unique email address, then that is a possibility to use to distinguish between ones with the same name. In Sweden, where this is known as the 'Anders Andersson' problem (that being the most common name in Sweden, and any organisation with more than a handful of members is likely to have several), a good many apps are now showing pictures of the Anders Anderssons and asking people to select based on that. The upshot of this is that Sweden is discovering that Prosopagnosia -- difficulty in telling the difference between faces is rather more common than has been known. Just in case you come up with this idea yourself Laura ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Does composition only work with particular instances of objects?
I was looking at an example illustrating composition from the book, "Introducing Python" by Bill Lubanovic on p. 140: >>> class Bill: def __init__(self, description): self.description = description >>> class Tail: def __init__(self, length): self.length = length >>> class Duck: def __init__(self, bill, tail): self.bill = bill self.tail = tail def about(self): print('This duck has a', bill.description, 'bill and a', tail.length, 'tail.') Here I was mildly surprised that bill and tail were not Bill and Tail, and in the about method that self.bill was not used in place of bill.description, etc. Continuing: >>> tail = Tail('long') >>> bill = Bill('wide orange') >>> duck = Duck(bill, tail) >>> duck.about() This duck has a wide orange bill and a long tail. So I naively thought I could do the following: >>> bill0 = Bill('narrow rainbow') >>> tail0 = Tail('ginormous') And was surprised by: >>> duck.about() This duck has a wide orange bill and a long tail. >>> duck0 = Duck(bill0, tail0) >>> duck0.about() This duck has a wide orange bill and a long tail. >From this I am forced to conclude that composition will only work with particular instances of objects and not with any old objects created from their respective classes. Is this understanding correct? Thanks! -- boB ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How to effectively use a Student class with SQLite [Was Re: How to design object interactions with an SQLite db?]
On Thu, Aug 13, 2015 at 11:13 PM, Laura Creighton wrote: > If your students need to provide a unique email address, then that is > a possibility to use to distinguish between ones with the same name. Many of my wife's students do have their own email accounts, but, alas, not all of them. I have not totally thought this through yet, but the student data will include their parents' names and some of their data. But it will be my luck that two students will have the same name, John Allan Smith, with their dads having the same name! But I guess I can list both parents' names. Surely that would enable the user to reliably pick the correct student? As an aside, when discussing my wife's user requirements for this project, I found out that some of her students have, shall we say, a variety of parents: birth parents, multiple step-parents, parents who are not allowed to have contact with their children, legal guardians who are not parents, etc. Ay, yi, yi! -- boB ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Does composition only work with particular instances of objects?
On Thu, Aug 13, 2015 at 11:31 PM, boB Stepp wrote: > I was looking at an example illustrating composition from the book, > "Introducing Python" by Bill Lubanovic on p. 140: > class Bill: > def __init__(self, description): > self.description = description > class Tail: > def __init__(self, length): > self.length = length > class Duck: > def __init__(self, bill, tail): > self.bill = bill > self.tail = tail > def about(self): > print('This duck has a', bill.description, 'bill and a', > tail.length, 'tail.') > > Here I was mildly surprised that bill and tail were not Bill and Tail, > and in the about method that self.bill was not used in place of > bill.description, etc. Something went wrong here, either with the example itself or your copying of it. Your instinct is correct, it should be 'self.bill.description' rather than 'bill.description': the Duck.about method as written above will only work in situations where 'bill' and 'tail' happen to be defined in the calling scope. The about method should be: def about(self): print('This duck has a', self.bill.description, 'bill and a', self.tail.length, 'tail.') > Continuing: > tail = Tail('long') bill = Bill('wide orange') duck = Duck(bill, tail) duck.about() > This duck has a wide orange bill and a long tail. Before you fix the about method as I suggested above, try this again but do `del bill, tail` before you call `duck.about()`; the failure may be somewhat enlightening. > So I naively thought I could do the following: > bill0 = Bill('narrow rainbow') tail0 = Tail('ginormous') > > And was surprised by: > duck.about() > This duck has a wide orange bill and a long tail. duck0 = Duck(bill0, tail0) duck0.about() > This duck has a wide orange bill and a long tail. > > From this I am forced to conclude that composition will only work with > particular instances of objects and not with any old objects created > from their respective classes. Is this understanding correct? Very much not :). You were correct to think this was meant to give you 'This duck has a narrow rainbow bill and a ginormous tail.', but the about method had a serious bug. -- Zach ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Does composition only work with particular instances of objects?
On Thu, Aug 13, 2015 at 11:46 PM, Zachary Ware wrote: > On Thu, Aug 13, 2015 at 11:31 PM, boB Stepp wrote: >> I was looking at an example illustrating composition from the book, >> "Introducing Python" by Bill Lubanovic on p. 140: >> > class Bill: >> def __init__(self, description): >> self.description = description >> > class Tail: >> def __init__(self, length): >> self.length = length >> > class Duck: >> def __init__(self, bill, tail): >> self.bill = bill >> self.tail = tail >> def about(self): >> print('This duck has a', bill.description, 'bill and a', >> tail.length, 'tail.') >> >> Here I was mildly surprised that bill and tail were not Bill and Tail, >> and in the about method that self.bill was not used in place of >> bill.description, etc. Well, I was wrong about "Bill" and "Tail", but, then again, that came from trying to make the flawed example work as I thought it should work with things like: class Duck: def __init__(self, Bill, Tail): self.bill = Bill.__init__.description etc. Which, of course, I could not make work. But I should have explored adding the "self" where I thought it should have been used. > Something went wrong here, either with the example itself or your > copying of it... Alas, it is an error in the book. The only alteration I made in the author's code was to drop the parentheses after the class names, that is, I used "class Bill:" instead of the author's "class Bill():". I also added a "." after "'tail'" in the about method, but that truly is an itty, bitty thing. > ...Your instinct is correct, it should be > 'self.bill.description' rather than 'bill.description': the Duck.about > method as written above will only work in situations where 'bill' and > 'tail' happen to be defined in the calling scope. The about method > should be: > >def about(self): >print('This duck has a', self.bill.description, > 'bill and a', self.tail.length, 'tail.') > > >> Continuing: >> > tail = Tail('long') > bill = Bill('wide orange') > duck = Duck(bill, tail) > duck.about() >> This duck has a wide orange bill and a long tail. > > Before you fix the about method as I suggested above, try this again > but do `del bill, tail` before you call `duck.about()`; the failure > may be somewhat enlightening. Yeah, I was dead certain that the book's example as written would only work for the particular objects "bill" and "tail" and not for any objects used for those in "Duck(bill, tail)" and this made absolutely no sense to me. Why limit composition to work with only particular instances of objects??? I probably should have gone ahead and played with the substitutions you suggested. "bill.description" and "tail.length" just did not make any sense to me. Thanks, Zach! I will have to see if the book has an errata site. boB ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor