On Sun, Jan 4, 2009 at 14:18, prasad rao <prasadarao...@gmail.com> wrote: >>>> z=[] >>>> for x in range(1000): > if divmod(x,3)[1]==0:z.append(x) > if divmod(x,5)[1]==0:z.append(x) >>>> sum(set(z)) > 233168
This can be done in one line of python. >>> sum([x for x in range(1000) if x %3 == 0 or x % 5 == 0]) 233168 Greets Sander _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor