[Tutor] repply

2009-01-04 Thread prasad rao
hi I got it right. 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 I am sorry if this is outside the perimeter of this list. ___ Tutor maillist - Tutor@python.org

Re: [Tutor] repply

2009-01-04 Thread Sander Sweers
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

Re: [Tutor] Repply

2008-12-27 Thread Alan Gauld
prasad rao prasadarao...@gmail.com wrote http://svn.python.org/view/python/trunk/Objects/listobject.c?rev=67498view=markup Kent ! This is grek and latin to me.From the presence of header files it looks C++.But headerfiles are not between '' and '' . Its C rather than C++. The in

Re: [Tutor] Repply

2008-12-27 Thread W W
On Sat, Dec 27, 2008 at 3:42 AM, Alan Gauld alan.ga...@btinternet.comwrote: Its C rather than C++. The in include statements are a variation on the which can also be used. The differences are subtle and have to do with the search path I think. But its been so long since I did serious

[Tutor] Repply

2008-12-26 Thread prasad rao
Thanks for help. http://svn.python.org/view/python/trunk/Objects/listobject.c?rev=67498view=markup Kent ! This is grek and latin to me.From the presence of header files it looks C++.But headerfiles are not between '' and '' . But why are you trying to sort in this fashion? Alan Gauld!