Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80142
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <davea@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.013 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'defaults': 0.07; 'elegant': 0.07; 'suppose': 0.07; '[1]:': 0.09; 'lawrence': 0.09; 'parameter': 0.09; '(big': 0.16; 'ans': 0.16; 'btw': 0.16; 'empty,': 0.16; 'iterable': 0.16; 'subject: \n ': 0.16; 'subject:after': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; '(not': 0.18; 'module': 0.19; '>>>': 0.22; 'print': 0.22; 'header :User-Agent:1': 0.23; 'lets': 0.24; 'math': 0.24; 'question': 0.24; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'function': 0.29; 'am,': 0.29; 'url:mailman': 0.30; '(which': 0.31; 'asked': 0.31; 'code': 0.31; '100000': 0.31; '>>>>': 0.31; 'subject:what': 0.31; 'trivial': 0.31; 'stuff': 0.32; 'run': 0.32; 'url:python': 0.33; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'programming,': 0.36; 'url:listinfo': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'example,': 0.37; 'project': 0.37; 'sometimes': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'help,': 0.39; 'subject:can': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'numbers': 0.61; 'range': 0.61; "you're": 0.61; 'sum': 0.64; 'teaching': 0.64; 'more': 0.64; 'received:74.208': 0.68; 'otten': 0.84; 'start.': 0.84; 'strings)': 0.84; 'joel': 0.91 |
| Date | Sun, 02 Nov 2014 17:07:34 -0500 |
| From | Dave Angel <davea@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: what can i do to improve my skill after finished python course on codecademy |
| References | <957d3844-9b9a-47b7-892f-b7660aa40d88@googlegroups.com> <mLc5w.736949$KL.181699@fx19.am4> <m33u0r$lnn$1@reader1.panix.com> <b1efa476-0eb4-49c2-b890-89c5417370e7@googlegroups.com> <m35hda$liv$1@ger.gmane.org> <mailman.15411.1414948574.18130.python-list@python.org> <4c0d5apoa3455vmkgdtp7nn25pl85fgmoh@4ax.com> <mailman.15414.1414957509.18130.python-list@python.org> <d26d5adlmfnkaji1ico6dpv9djah2obp1m@4ax.com> |
| In-Reply-To | <d26d5adlmfnkaji1ico6dpv9djah2obp1m@4ax.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:ffWDXhWQQLjSlTYGXE0ELaXY8JQ+jVlq+m6VOmEPnw3 ltyreCqclELu1/avMLs2fFOAaY4SnjpCEHC3UFYTSOzRnns28O olCe4BOpXPDR3BoZafrH+N7tQIX/DGf+1ur4Wehp+/neiBigOK 1rter1pmWHRLjPOAYSjw7tls+dFZOHzz7ir4DAPM2zlVGIovPU +uR74S+7CxxUXd9V9v5ou+VWLGi0vc8BY67/iU7KHjqjPLTQI5 mg67YSZROvJBVkX5rPTbj7pktQ715juhogM8We3TPj6U3xe35r OHWqC1Y9q/0baiOXNLz/A/FtnovYaA4Yv0Wjoot/v/jvsPQR3y SldEcyxLbIuLpTnKZaGs= |
| X-UI-Out-Filterresults | notjunk:1; |
| 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.15419.1414966072.18130.python-list@python.org> (permalink) |
| Lines | 66 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1414966072 news.xs4all.nl 2851 [2001:888:2000:d::a6]:36109 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:80142 |
Show key headers only | View raw
On 11/02/2014 04:03 PM, Seymore4Head wrote:
> On Sun, 02 Nov 2014 19:42:49 +0000, Mark Lawrence
> <breamoreboy@yahoo.co.uk> wrote:
>
>> On 02/11/2014 19:10, Seymore4Head wrote:
>>> On Sun, 2 Nov 2014 12:16:11 -0500, Joel Goldstick
>>> <joel.goldstick@gmail.com> wrote:
>>>
>>>> On Sun, Nov 2, 2014 at 10:08 AM, Peter Otten <__peter__@web.de> wrote:
>>>>> Huhuai Fan wrote:
>>>>>
>>>>>> Thanks for your help, but i have no idea to find a project that i can
>>>>>> complete,i am now in perplexed for what to do
>>>>>
>>>>> Then write a small text-based brainstorming app!
>>>>>
>>>>> --
>>>>> https://mail.python.org/mailman/listinfo/python-list
>>>>
>>>> If you like math puzzles you can do the euler project stuff
>>>
>>> target=1000
>>> thelist=[]
>>> thesum=0
>>> for x in range (1,target):
>>> if x%3==0: thelist.append(x)
>>> if x%5==0 and x%3!=0: thelist.append(x)
>>> for x in thelist: thesum+=x
>>> print(thelist)
>>> print (thesum)
>>>
>>
>> In [1]: help(sum)
>> Help on built-in function sum in module builtins:
>>
>> sum(...)
>> sum(iterable[, start]) -> value
>>
>> Return the sum of an iterable of numbers (NOT strings) plus the value
>> of parameter 'start' (which defaults to 0). When the iterable is
>> empty, return start.
>
> BTW I have the answer to question 2, but there is no way I would run
> the code on numbers much more than 100000 and it wants the answer for
> 4,000,000.
>
So that's teaching you that there must be a more elegant approach than
brute-force. Sometimes you can use cleverer programming, sometimes you
need cleverer math. Sometimes both.
As a trivial example, suppose you're asked to sum the numbers from 1000
to 10**25
Brute force would take a few millenia, as something like
ans = sum(range( BIG ) - sum(range(1000))
But just knowing the math lets you simplify it to something like
ans = (1000 + BIG) * (BIG - 1000) / 2
(give or take a few plus/minus ones)
--
DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
what can i do to improve my skill after finished python course on codecademy fanhuhuai@gmail.com - 2014-11-01 08:01 -0700
Re: what can i do to improve my skill after finished python course on codecademy alister <alister.nospam.ware@ntlworld.com> - 2014-11-01 22:01 +0000
Re: what can i do to improve my skill after finished python course on codecademy Chris Angelico <rosuav@gmail.com> - 2014-11-02 09:10 +1100
Re: what can i do to improve my skill after finished python course on codecademy Grant Edwards <invalid@invalid.invalid> - 2014-11-02 00:31 +0000
Re: what can i do to improve my skill after finished python course on codecademy MRAB <python@mrabarnett.plus.com> - 2014-11-02 00:55 +0000
Re: what can i do to improve my skill after finished python course on codecademy Chris Angelico <rosuav@gmail.com> - 2014-11-02 12:02 +1100
Re: what can i do to improve my skill after finished python course on codecademy Grant Edwards <invalid@invalid.invalid> - 2014-11-02 17:30 +0000
Re: what can i do to improve my skill after finished python course on codecademy Huhuai Fan <fanhuhuai@gmail.com> - 2014-11-02 06:49 -0800
Re: what can i do to improve my skill after finished python course on codecademy Peter Otten <__peter__@web.de> - 2014-11-02 16:08 +0100
Re: what can i do to improve my skill after finished python course on codecademy Joel Goldstick <joel.goldstick@gmail.com> - 2014-11-02 12:16 -0500
Re: what can i do to improve my skill after finished python course on codecademy Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-11-02 14:10 -0500
Re: what can i do to improve my skill after finished python course on codecademy Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-02 19:42 +0000
Re: what can i do to improve my skill after finished python course on codecademy Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-11-02 15:45 -0500
Re: what can i do to improve my skill after finished python course on codecademy Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-11-02 16:03 -0500
Re: what can i do to improve my skill after finished python course on codecademy Joel Goldstick <joel.goldstick@gmail.com> - 2014-11-02 17:00 -0500
Re: what can i do to improve my skill after finished python course on codecademy Dave Angel <davea@davea.name> - 2014-11-02 17:07 -0500
Re: what can i do to improve my skill after finished python course on codecademy Chris Angelico <rosuav@gmail.com> - 2014-11-03 09:12 +1100
Re: what can i do to improve my skill after finished python course on codecademy Abhiram <abhi.darkness@gmail.com> - 2014-11-02 22:51 +0530
csiph-web