Hi Brian It was a excellent tutorial, Thanks a lot for the advice I got my concepts of def of functions , sort functions , count , cleared for me I was able to do and understand all the function example , except “item_comparison” function I get the error for set >>> set((1,1,1,2,2,2,2,2,3,4,4,5)) Traceback (most recent call last): File "<stdin>", line 1, in ? NameError: name 'set' is not defined
my python versrion is Python 2.3.4 (#1, Nov 4 2004, 14:06:56) [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2 THANKS Joseph John --- Brian van den Broek <[EMAIL PROTECTED]> wrote: > John Joseph said unto the world upon 08/01/06 06:36 We no longer need the continue clause, as converting to set ensures we won't ever deal with the same item twice: >>> set((1,1,1,2,2,2,2,2,3,4,4,5)) set([1, 2, 3, 4, 5]) And, preventing us from dealing with the same item twice is what makes this better. To see that, consider: >>> def iteration_comparison(sequence): list_count = 0 set_count = 0 for i in list(sequence): list_count += 1 for i in set(sequence): set_count += 1 print list_count, set_count === message truncated === ___________________________________________________________ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor