Re: symple programming task

2014-04-21 Thread Chris Angelico
On Mon, Apr 21, 2014 at 11:21 PM, Ivan Ivanivich wrote: > if "basis" is 15, then "mod" == 0 twice - when the "divider" is 3 and 15 Good! Yes, you worked out exactly what the problem is. :) There are ways to simplify your code, but it's now giving the correct result, so that's the most important

Re: symple programming task

2014-04-21 Thread Tim Chase
On 2014-04-21 06:21, Ivan Ivanivich wrote: > > Find the sum of all the multiples of 3 or 5 below 1000. > my new version of script: > > total = 0 > div1 = 3 > div2 = 5 > for basis in range(0, 1000): > mod = basis % div1 > if mod == 0: > total = total + basis >

Re: symple programming task

2014-04-21 Thread Ivan Ivanivich
On Sunday, April 20, 2014 10:43:37 PM UTC+4, Ivan Ivanivich wrote: > hi all, i have simple programming task: > > > > [quot] > > If we list all the natural numbers below 10 that are multiples of 3 or 5, we > get 3, 5, 6 and 9. The sum of these multiples is 23. > > > > Find the sum of all the

Re: symple programming task

2014-04-21 Thread Joshua Landau
On 20 April 2014 20:27, Ivan Ivanivich wrote: > thanks, i found the bag G'day. This [https://xkcd.com/979/] applies to threads ending in "nvm, solved it" too. I know the problem in your case isn't likely to be widely useful, but there are other benefits of pointing out what you've done. For exam

Re: symple programming task

2014-04-20 Thread Ivan Ivanivich
On Sunday, April 20, 2014 10:43:37 PM UTC+4, Ivan Ivanivich wrote: > hi all, i have simple programming task: > > > > [quot] > > If we list all the natural numbers below 10 that are multiples of 3 or 5, we > get 3, 5, 6 and 9. The sum of these multiples is 23. > > > > Find the sum of all the

Re: symple programming task

2014-04-20 Thread Joel Goldstick
On Sun, Apr 20, 2014 at 3:02 PM, Chris Angelico wrote: > On Mon, Apr 21, 2014 at 4:43 AM, Ivan Ivanivich > wrote: > > [quot] > > If we list all the natural numbers below 10 that are multiples of 3 or > 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. > > > > Find the sum of all the mul

Re: symple programming task

2014-04-20 Thread Peter Otten
Ivan Ivanivich wrote: > hi all, i have simple programming task: > > [quot] > If we list all the natural numbers below 10 that are multiples of 3 or 5, > we get 3, 5, 6 and 9. The sum of these multiples is 23. > > Find the sum of all the multiples of 3 or 5 below 1000. > [/quote] > > this task f

Re: symple programming task

2014-04-20 Thread Chris Angelico
On Mon, Apr 21, 2014 at 4:43 AM, Ivan Ivanivich wrote: > [quot] > If we list all the natural numbers below 10 that are multiples of 3 or 5, we > get 3, 5, 6 and 9. The sum of these multiples is 23. > > Find the sum of all the multiples of 3 or 5 below 1000. > [/quote] > > this task from http://pr