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


Groups > comp.lang.python > #101213

Re: Consistent error

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Ian Kelly <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Subject Re: Consistent error
Date Sun, 3 Jan 2016 09:27:50 -0700
Lines 36
Message-ID <mailman.209.1451838512.11925.python-list@python.org> (permalink)
References <6f54629c-745f-4f75-a267-0f174cc1aea1@googlegroups.com> <mailman.205.1451832473.11925.python-list@python.org> <2a7c4d1e-b7ba-4fb7-845f-440026af3b59@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de 51IeXREArD/+jLz2cUXqOQ3JZxEdVHjp+JutKGU8Mchw==
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'assignment': 0.07; 'unittest': 0.07; 'jan': 0.11; 'subject:error': 0.11; 'def': 0.13; '2016': 0.16; 'add,': 0.16; 'list"': 0.16; 'quoted': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'rewritten': 0.16; 'wrote:': 0.16; 'algorithm': 0.20; 'fix': 0.21; 'fixing': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; "i've": 0.25; 'not.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'looks': 0.29; 'testing.': 0.29; 'error.': 0.31; 'largest': 0.31; 'know.': 0.34; 'thanks!': 0.34; 'advice': 0.35; 'gives': 0.35; 'received:google.com': 0.35; 'but': 0.36; 'should': 0.36; 'lines': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'thanks': 0.37; 'received:209.85.213': 0.37; 'seem': 0.37; 'received:209': 0.38; 'anything': 0.38; 'test': 0.39; 'to:addr:python.org': 0.40; 'still': 0.40; 'some': 0.40; 'post,': 0.84; 'to:name:python': 0.84; 'step.': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=UKLSOjqMf2RtwWZjMOMB2pJrCKgutM/7bfn6y+2xT3g=; b=HR9Hn+KtKZByUaWauiC55YVpW4JRUUGtdzmIRuGs+j3j2rl11WhdmmiNjN1layMHz8 LJ44Bw1ghT4Pse3mefoJCt0AqrtRnEyZ8w6QfHQCgkhSvQ7nT2v1QW7xMynYE/jWh066 XA1/bOym4dRL8KQMs48TRdCV2LfTJwV6EPuncCAUaurP4JuRKo1wrNJHNPNifamNZ8HD GI5OnOGV9EsU/VlmTbpdztbhq/5wlWnCFBijP2/6AHGUxdhWc0+qnZ9lYt6WR010kMP3 A4+Xif86ZNQLl3FjDfg1YfLCn9EugFb4N1jjruySf7KxSbVPmEb14H5Y0VeKuscxFVZc qpxg==
X-Received by 10.50.65.39 with SMTP id u7mr78942132igs.85.1451838509300; Sun, 03 Jan 2016 08:28:29 -0800 (PST)
In-Reply-To <2a7c4d1e-b7ba-4fb7-845f-440026af3b59@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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>
Xref csiph.com comp.lang.python:101213

Show key headers only | View raw


On Sun, Jan 3, 2016 at 8:59 AM,  <cc.fezeribe@gmail.com> wrote:
> Thanks Chris!
> Don't worry about the indent, will fix it
> I've rewritten it to this-
>
>  def get_algorithm_result( numlist ):
>>  largest = numlist[0]
>>  i = 1
>>  while ( i < len(numlist) ):
>      i = i + 1
>>    if ( largest < numlist[i]):
>>      largest = numlist[i]
>>      numlist[i] = numlist[-1]
>>      numlist = [1,2,3,4,5]
>        return largest

This is even harder to read than before since some of the lines are
now quoted and some are not.

>> def prime_number(x):
>>  return len([n for n in range(1, x + 1) if x % n == 0]) <= 2
>
> But it still gives the test_maximum_number_one error.
> Please if you have any ideas what else I should change or add, let me know. Thanks!

It's hard to give any specific advice about fixing the unittest
failure without knowing what the test is testing. These two lines
don't seem to have anything to do with the algorithm that you quoted
in the first post, however:

>      numlist[i] = numlist[-1]
>      numlist = [1,2,3,4,5]

It looks like you should kill everything in this function after the
assignment to largest and then start reimplementing the algorithm
again from the " If Li is last number from  the list" step.

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


Thread

Consistent error cc.fezeribe@gmail.com - 2016-01-03 06:35 -0800
  Re: Consistent error Chris Angelico <rosuav@gmail.com> - 2016-01-04 01:47 +1100
    Re: Consistent error cc.fezeribe@gmail.com - 2016-01-03 07:59 -0800
      Re: Consistent error Chris Angelico <rosuav@gmail.com> - 2016-01-04 03:14 +1100
        Re: Consistent error cc.fezeribe@gmail.com - 2016-01-03 08:55 -0800
          Re: Consistent error Alister <alister.ware@ntlworld.com> - 2016-01-03 18:22 +0000
      Re: Consistent error Ian Kelly <ian.g.kelly@gmail.com> - 2016-01-03 09:27 -0700
        Re: Consistent error cc.fezeribe@gmail.com - 2016-01-03 08:59 -0800
          Re: Consistent error iykeluvzu@gmail.com - 2016-01-15 06:15 -0800

csiph-web