Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #70426

Re: symple programming task

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.022
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; '21,': 0.07; '1000.': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'wrote': 0.14; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'ivan': 0.16; 'multiples': 0.16; 'subject:programming': 0.16; 'there?': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'script': 0.25; 'task': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'returned': 0.30; 'message-id:@mail.gmail.com': 0.30; 'there.': 0.32; 'actual': 0.34; "i'd": 0.34; 'problem': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'list': 0.37; 'rather': 0.38; 'expect': 0.39; 'tell': 0.60; 'numbers': 0.61; 'simply': 0.61; "you're": 0.61; 'sum': 0.64; 'natural': 0.68; 'hints': 0.68; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=Vw9gnYB2UfXQBBEJimbLUg2qXQ4EVROKSrWQ0TX1PYI=; b=lANmkitUqUWRwBDk6gHovjwFux9LUb7BVOAdCzIjrrjTqlUCGV6q/UneM7QMq8dhNv 3UZjYAwfwT07xgejFtZmSbJ/EdVTF596Jr3AssDKPeHxK2agrrnRNtoeV7r8zBKwE/YA XkbDIxBedk2JRgTYLwbOcv1GrHlBHpJxmz5rfYayMJesIyrDg0iqS0SptnhWY4CSTNB2 TXAKh5ms7qrWakaVxqVVhh+MIU6Q7oLmfkmYWp4+SlBiFVWljTa3kznlCLINu9m6GaVE 6mvCmCLxBJ9SShBg/lxHonao4PMyMwkWqBxdkTE6QXbJPPa35YOOSWdelX7afZG1ADyQ 45HQ==
MIME-Version 1.0
X-Received by 10.220.106.84 with SMTP id w20mr26042320vco.18.1398020546029; Sun, 20 Apr 2014 12:02:26 -0700 (PDT)
In-Reply-To <cc416b4b-e19d-49b9-abc2-86bcff455f9c@googlegroups.com>
References <cc416b4b-e19d-49b9-abc2-86bcff455f9c@googlegroups.com>
Date Mon, 21 Apr 2014 05:02:25 +1000
Subject Re: symple programming task
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.9384.1398020548.18130.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1398020548 news.xs4all.nl 2934 [2001:888:2000:d::a6]:37908
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:70426

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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