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


Groups > comp.lang.python > #57639

Re: Check if this basic Python script is coded right

Path csiph.com!usenet.pasdenom.info!aioe.org!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 <joel.goldstick@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.149
X-Spam-Level *
X-Spam-Evidence '*H*': 0.74; '*S*': 0.04; 'subject:Python': 0.06; 'get.': 0.09; 'subject:script': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'assignment.': 0.16; 'guessing': 0.16; 'multiples': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**0': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'prints': 0.31; 'run': 0.32; 'url:python': 0.33; 'could': 0.34; 'basic': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'url:listinfo': 0.36; 'doing': 0.36; 'url:org': 0.36; 'should': 0.36; 'pm,': 0.38; 'university': 0.39; 'url:mail': 0.40; 'numbers': 0.61; 'first': 0.61; 'sum': 0.64; 'skip:+ 10': 0.65; 'between': 0.67; '26,': 0.68; 'results': 0.69; 'subject:this': 0.83; 'cubes': 0.84; 'hand.': 0.84; 'joel': 0.91; 'ultimate': 0.93; 'subject:Check': 0.95; '2013': 0.98
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:to :cc:content-type; bh=7RQaB4cM7FVIDKvYRv5ZS0NBGscluz9IqfqYd8I4chI=; b=YeiZDACgfIxQl/plnS6LdH+hnQJqqqQ8BO7wYG1DCvcpZ7qFhw8jRVUCDce8C3UWag LILhAwbl+Kip/vUciMbnFHRw7RqqQslfs7m2E4CO+J1yKOAflIyuZmbHn4Kwc5FM6j4y YVLeLjhq5Wvv+Xe3yQ0k+OGy/EPc7656OdQ4wwyYO2Y24DBHMfAAz3Z50R+uUeyPARhP FkpRe13LTT9WEoNvOx1cDWdwnEMVjdb7J0IcpKk0FnVyn/OARBKoaxh0Iew831DyXBZa YNNRCRhCkTKTldKy4b0PVY2RdWLNR6X6/iKc9XZRPjsN41UXabUwzkWsBaYBN7vlgdUf +WQQ==
MIME-Version 1.0
X-Received by 10.52.98.99 with SMTP id eh3mr6601815vdb.29.1382810010478; Sat, 26 Oct 2013 10:53:30 -0700 (PDT)
In-Reply-To <9716695c-31e3-40a0-b2a4-73b967494107@googlegroups.com>
References <9716695c-31e3-40a0-b2a4-73b967494107@googlegroups.com>
Date Sat, 26 Oct 2013 13:53:30 -0400
Subject Re: Check if this basic Python script is coded right
From Joel Goldstick <joel.goldstick@gmail.com>
To HC <hikmat@jafarli.net>
Content-Type text/plain; charset=UTF-8
Cc "python-list@python.org" <python-list@python.org>
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.1592.1382810012.18130.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1382810012 news.xs4all.nl 15962 [2001:888:2000:d::a6]:59529
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:57639

Show key headers only | View raw


On Sat, Oct 26, 2013 at 1:36 PM, HC <hikmat@jafarli.net> wrote:
> I'm doing my first year in university and I need help with this basic assignment.
>
> Assignment: Write Python script that prints sum of cubes of numbers between 0-200 that are multiples of 3. 3^3+6^3+9^3+12^3....+198^3=?
>
> My script:
> count = 0
> answer = 0
>
> while count<200:
>     if count%3==0:
>         answer = answer + count**3
>     count = count + 1
>
> print ("Result is: " +str(answer))
>
> Is it all okay?
>
> Regards
> --
> https://mail.python.org/mailman/listinfo/python-list

You should run it to see what results you get.  I am guessing that you
don't know the ultimate answer, but you could run it for a much
smaller number than 200 and check the results by hand.



-- 
Joel Goldstick
http://joelgoldstick.com

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Check if this basic Python script is coded right HC <hikmat@jafarli.net> - 2013-10-26 10:36 -0700
  Re: Check if this basic Python script is coded right Joel Goldstick <joel.goldstick@gmail.com> - 2013-10-26 13:53 -0400
  Re: Check if this basic Python script is coded right Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-26 18:55 +0100
  Re: Check if this basic Python script is coded right John Ladasky <john_ladasky@sbcglobal.net> - 2013-10-26 10:58 -0700
  Re: Check if this basic Python script is coded right MRAB <python@mrabarnett.plus.com> - 2013-10-26 19:20 +0100
    Re: Check if this basic Python script is coded right rusi <rustompmody@gmail.com> - 2013-10-27 05:20 -0700
      Re: Check if this basic Python script is coded right Tim Delaney <timothy.c.delaney@gmail.com> - 2013-10-28 08:30 +1100
  Re: Check if this basic Python script is coded right Terry Reedy <tjreedy@udel.edu> - 2013-10-26 15:46 -0400
  Re: Check if this basic Python script is coded right Terry Reedy <tjreedy@udel.edu> - 2013-10-26 16:16 -0400

csiph-web