George Yoshida wrote: > Rakesh wrote: > > > To quote a much smaller trimmed-down example, here is how it looks > > like: > > ## ----------------------------------------------- > > # Entry Point to the whole program > > ## ----------------------------------------------- > > def main(): > > mylist = GenerateList() > > minnumber = min(mylist) > > for num in mylist: > > print num - minnumber > > ## TODO: Interpreter errors above. > > > Try printing mylist. Then you'll know why - operand doesn't work. > You're creating a nested tuple. > > I'd recommend changing the original script to something like:: > > seconds = [] > [snip] > > # Convert the date format to the seconds since epoch > for i in xrange( len(dates) ): > thissecond = parseDate(dates[i][1]) > seconds.append(thissecond) > > or if you want to stick with tuple:: > > seconds = () > [snip] > > # Convert the date format to the seconds since epoch > for i in xrange( len(dates) ): > thissecond = parseDate(dates[i][1]) > seconds += (thissecond, ) > > -- george
Thanks. That fixed the problem. ## -------------------------------------------- ## Generate a list ## -------------------------------------------- def GenerateList(): array = [] for i in xrange(10): array.append(i) return array ## ----------------------------------------------- # Entry Point to the whole program ## ----------------------------------------------- def main(): mylist = GenerateList() minnumber = min(mylist) for num in mylist: print num - minnumber ## -------------------------------- # Entry-point to the whole program ## -------------------------------- main() This is how my revised code looks like -- http://mail.python.org/mailman/listinfo/python-list