Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #70427
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'scripts': 0.03; 'output': 0.05; 'say,': 0.05; '1000.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'wrote': 0.14; 'ivan': 0.16; 'multiples': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:programming': 0.16; 'task:': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'all,': 0.19; 'programming': 0.22; 'header:User-Agent:1': 0.23; 'closely': 0.24; 'script.': 0.24; 'fine': 0.24; 'script': 0.25; 'compare': 0.26; 'task': 0.26; 'header:X-Complaints-To:1': 0.27; 'returned': 0.30; 'calculated': 0.31; 'mod': 0.31; 'skip:# 10': 0.33; 'problem': 0.35; 'but': 0.35; 'list': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'numbers': 0.61; 'simple': 0.61; 'sum': 0.64; 'total': 0.65; 'natural': 0.68; '20,': 0.68; 'basis)': 0.84; 'total,': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Peter Otten <__peter__@web.de> |
| Subject | Re: symple programming task |
| Date | Sun, 20 Apr 2014 21:11:09 +0200 |
| Organization | None |
| References | <cc416b4b-e19d-49b9-abc2-86bcff455f9c@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Gmane-NNTP-Posting-Host | p57bdb3b9.dip0.t-ipconnect.de |
| User-Agent | KNode/4.11.5 |
| 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.9385.1398021090.18130.python-list@python.org> (permalink) |
| Lines | 53 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1398021090 news.xs4all.nl 2862 [2001:888:2000:d::a6]:42306 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:70427 |
Show key headers only | View raw
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 from http://projecteuler.net/ site
>
> I wrote a solution in python
>
> http://pastebin.com/QXtNuRWU
[for small scripts it is fine to include them directly in your post]
> #!/usr/bin/env python3.2
>
> total = 0
> for divider in 3, 5:
> basis=divider
> while basis < 1000:
> mod = basis % divider
> if mod == 0:
> total = total + basis
> print("total = ", total, "basis = ", basis)
>
> basis += 1
>
> print("total", total)
> 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
>
> it is my script problem or site not working correctly?
Your script. Try it for the numbers below 20, say, and then compare to a
result you calculated with pen and paper.
Or look closely at the output produced by the line
> print("total = ", total, "basis = ", basis)
in your code.
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