Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #70426
| References | <cc416b4b-e19d-49b9-abc2-86bcff455f9c@googlegroups.com> |
|---|---|
| Date | 2014-04-21 05:02 +1000 |
| Subject | Re: symple programming task |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.9384.1398020548.18130.python-list@python.org> (permalink) |
On Mon, Apr 21, 2014 at 4:43 AM, Ivan Ivanivich <ivriabtsov@gmail.com> 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://projecteuler.net/ site > > I wrote a solution in python > > http://pastebin.com/QXtNuRWU > > this script returned correctly result if "basis < 10", but if "basis < 1000" result is 266333 and it is not correctly answer on site http://projecteuler.net Try listing the actual numbers you're summing, and check if there's a problem there. Are all the numbers you expect appearing? Are any you don't want there? (I can see exactly what your problem is, but I'd rather give hints rather than simply tell you outright what's wrong.) ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
symple programming task Ivan Ivanivich <ivriabtsov@gmail.com> - 2014-04-20 11:43 -0700
Re: symple programming task Chris Angelico <rosuav@gmail.com> - 2014-04-21 05:02 +1000
Re: symple programming task Peter Otten <__peter__@web.de> - 2014-04-20 21:11 +0200
Re: symple programming task Joel Goldstick <joel.goldstick@gmail.com> - 2014-04-20 15:15 -0400
Re: symple programming task Ivan Ivanivich <ivriabtsov@gmail.com> - 2014-04-20 12:27 -0700
Re: symple programming task Joshua Landau <joshua@landau.ws> - 2014-04-21 12:43 +0100
Re: symple programming task Ivan Ivanivich <ivriabtsov@gmail.com> - 2014-04-21 06:21 -0700
Re: symple programming task Tim Chase <python.list@tim.thechases.com> - 2014-04-21 08:39 -0500
Re: symple programming task Chris Angelico <rosuav@gmail.com> - 2014-04-21 23:43 +1000
csiph-web