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: 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 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> <4c0d5apoa3455vmkgdtp7nn25pl85fgmoh@4ax.com> In-Reply-To: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On 11/02/2014 04:03 PM, Seymore4Head wrote: > On Sun, 02 Nov 2014 19:42:49 +0000, Mark Lawrence > wrote: > >> On 02/11/2014 19:10, Seymore4Head wrote: >>> On Sun, 2 Nov 2014 12:16:11 -0500, Joel Goldstick >>> 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