Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #108562
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Igor Korot <ikorot01@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Average calculation Program *need help* |
| Date | Thu, 12 May 2016 12:06:24 -0400 |
| Lines | 37 |
| Message-ID | <mailman.613.1463069194.32212.python-list@python.org> (permalink) |
| References | <011a2f60-aafd-484f-8cb2-6017aaf1bb29@googlegroups.com> <CA+FnnTyM45xgcj_Hm7g-72mqnUE7mCHyF8pfdbw5yj5Cyg9o+Q@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de UAI8nvhka9djH4HB/viKgAp74VNzqJUJYl2+J+uPKkBA== |
| Return-Path | <ikorot01@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.027 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'subject:help': 0.07; 'cc:addr:python-list': 0.09; 'python.': 0.11; 'def': 0.13; 'translate': 0.15; 'thu,': 0.15; '"your': 0.16; '#this': 0.16; '2016': 0.16; 'range(0,': 0.16; 'range,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'subject:need': 0.18; 'all,': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'algorithm': 0.20; 'are.': 0.22; 'am,': 0.23; 'help.': 0.23; 'header:In-Reply-To:1': 0.24; 'error': 0.27; 'message- id:@mail.gmail.com': 0.27; 'function': 0.28; 'code:': 0.29; "i'm": 0.30; 'print': 0.30; '(including': 0.30; 'url:mailman': 0.30; 'code': 0.30; 'supposed': 0.31; 'run': 0.33; 'problem': 0.33; 'url:python': 0.33; 'url:listinfo': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'there': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'two': 0.37; '12,': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'someone': 0.38; 'thank': 0.38; 'hi,': 0.38; 'test': 0.39; 'url:mail': 0.40; 'still': 0.40; 'total': 0.62; 'you.': 0.64; 'hours': 0.65; 'between': 0.65; 'score': 0.76; 'number):': 0.84; 'score:': 0.84; 'subject: *': 0.84; 'scores': 0.91; 'average': 0.93; 'subject:*': 0.93 |
| 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-transfer-encoding; bh=u9DwBj//YBsKU/vK//yPCF/b4gW/1WwDUqsER0ej9NI=; b=YAYn/yVinoxMzTPeooP5d7dVGUl4usWvW0KazTcua0O7GPUJCu4QI3tsXcVyXsUjIn zREQ3WvRTMxwLAbZGnLukyy0lHh8M9EXVRPfohqrgDWMKrQjLOD0rMRrnoE2CyTwIXuk zstkq03idNlW0QmGjlwZ7vma4WGeg0z8hL5xeuUsq7WyzvkvY9wqsgAOlKxicR+QS0OY ci+g/08LYHeMDO3XmOCWcwn3ZKYXrnYNjYwnFmwT6wrCLBdmhzIeTC5TVACuVJEPAT3W lTek9mXF4RZazBYUtdWu82lvg2XZWBA43J1QCVxapf2z75is1tGC/8aNFqjF/E9Q2I1H inyg== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-transfer-encoding; bh=u9DwBj//YBsKU/vK//yPCF/b4gW/1WwDUqsER0ej9NI=; b=gM/NZ1nw/hAQtA2p2Bck4Ctzeb0oKtIBqqSKAFQM+TluaBVPXYHHDrN0UDszv14vOh bLCvKt7xaTboIF5YX4QZxAmECCqwv2Ezd6CVVgTo7TjvDqPpoEZaCODUZyNtSqhWjer3 PAVrwSVo7oB1MAzSQWMT3kO88tnU7tNIawySuABTipS1+nN7uxKlQIX1BQPDa0dWgAbu CUDQZML9/ap5LMdY3dYHAajRE3mfYRfL3cu3gCuUCQjpmOaweSgoKkAchpLgm5XE9VyH ll7rjWxJGV3OGDXbLVSSHaFr8xvnbVSjUqfsYcVyJhwZEkbSx9bpLzTBTV+4elhkmIye MklQ== |
| X-Gm-Message-State | AOPr4FVu8FFHTW04vDlQ643fjEYPELpb/O7TPc3QkyxsJu9XOYJ2pyR6PlDhrDk6nhjcKtPbBUvmWMrxKSoUow== |
| X-Received | by 10.176.4.20 with SMTP id 20mr5149308uav.125.1463069184702; Thu, 12 May 2016 09:06:24 -0700 (PDT) |
| In-Reply-To | <011a2f60-aafd-484f-8cb2-6017aaf1bb29@googlegroups.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| 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> |
| X-Mailman-Original-Message-ID | <CA+FnnTyM45xgcj_Hm7g-72mqnUE7mCHyF8pfdbw5yj5Cyg9o+Q@mail.gmail.com> |
| X-Mailman-Original-References | <011a2f60-aafd-484f-8cb2-6017aaf1bb29@googlegroups.com> |
| Xref | csiph.com comp.lang.python:108562 |
Show key headers only | View raw
Hi,
On Thu, May 12, 2016 at 11:47 AM, <kobsx4@gmail.com> wrote:
> Hello all, I have been struggling with this code for 3 hours now and I'm still stumped. My problem is that when I run the following code:
> ------------------------------------------------------------------------------
> #this function will get the total scores
> def getScores(totalScores, number):
> for counter in range(0, number):
> score = input('Enter their score: ')
> totalScores = totalScores + score
>
> while not (score >= 0 and score <= 100):
>
> print "Your score must be between 0 and 100."
> score = input('Enter their score: ')
>
>
>
> return totalScores
> ------------------------------------------------------------------------------
> the program is supposed to find the average of two test scores and if one of the scores is out of the score range (0-100), an error message is displayed. The main problem with this is that when someone types in a number outside of the range, it'll ask them to enter two scores again, but ends up adding all of the scores together (including the invalid ones) and dividing by how many there are. Please help.
Can you solve this problem with just pen and paper?
Do that and then translate the algorithm to python.
Thank you.
> --
> https://mail.python.org/mailman/listinfo/python-list
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Average calculation Program *need help* kobsx4@gmail.com - 2016-05-12 08:47 -0700
Re: Average calculation Program *need help* Rustom Mody <rustompmody@gmail.com> - 2016-05-12 09:01 -0700
Re: Average calculation Program *need help* Igor Korot <ikorot01@gmail.com> - 2016-05-12 12:06 -0400
Re: Average calculation Program *need help* DFS <nospam@dfs.com> - 2016-05-12 19:45 -0400
Re: Average calculation Program *need help* "Martin A. Brown" <martin@linux-ip.net> - 2016-05-12 09:13 -0700
Re: Average calculation Program *need help* MRAB <python@mrabarnett.plus.com> - 2016-05-12 17:14 +0100
Re: Average calculation Program *need help* Jake Kobs <kobsx4@gmail.com> - 2016-05-12 21:22 -0700
Re: Average calculation Program *need help* Ben Finney <ben+python@benfinney.id.au> - 2016-05-13 14:55 +1000
Re: Average calculation Program *need help* Michael Torrie <torriem@gmail.com> - 2016-05-12 22:57 -0600
Re: Average calculation Program *need help* Jake Kobs <kobsx4@gmail.com> - 2016-05-12 22:03 -0700
Re: Average calculation Program *need help* Michael Torrie <torriem@gmail.com> - 2016-05-12 23:29 -0600
Re: Average calculation Program *need help* DFS <nospam@dfs.com> - 2016-05-13 01:12 -0400
Re: Average calculation Program *need help* Jake Kobs <kobsx4@gmail.com> - 2016-05-12 22:46 -0700
Re: Average calculation Program *need help* Nick Sarbicki <nick.a.sarbicki@gmail.com> - 2016-05-13 07:10 +0000
Re: Average calculation Program *need help* Jake Kobs <kobsx4@gmail.com> - 2016-05-13 08:38 -0700
Re: Average calculation Program *need help* DFS <nospam@dfs.com> - 2016-05-13 12:17 -0400
csiph-web