Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.073 X-Spam-Evidence: '*H*': 0.85; '*S*': 0.00; 'run-time': 0.05; '22,': 0.09; 'literal.': 0.16; 'subject:issue': 0.16; 'wrote:': 0.17; 'feb': 0.19; 'tried': 0.25; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'fixed': 0.28; 'this?': 0.28; 'probably': 0.29; 'fri,': 0.30; 'code': 0.31; 'subject:Number': 0.33; 'to:addr:python-list': 0.33; 'hi,': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'clear': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'should': 0.36; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'provide': 0.62; 'more': 0.63; 'sounds': 0.71; '2013': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=JsDhZB5v6P9Al0XQwAYIPNMgbAHJb3wRnGba83gGb6o=; b=rYMfo7u36sY98NMMVQFezORdXnZmK1B09HV73o/4Spigj24F+3KediJdrsDO3qoo5f nD0AU6HfqzXT1438rXMq+/8gQ2jv+Ayd4qxLbSyE0BMlSt1CM+XbOPAHRCiwOAt9qgJN U1Cz3BimVprPOmJ+qwgo3kx34k8fos+Y5anCwuEPuvYpEzXLjAjaVaK4OdPbEbA9DnYd cYYNAh+p7iVp40QC1Kz7wBysDej85JF1ir4Qbqt6lh48CL6B2HcfKnXZ6QtGXsObOflU oLL7OYJrAHds485FJrbx9qJUFyasOf2vmcqJNUXIlpNwDJA8SBAelpWIA165ev6O2bVr 4JUg== X-Received: by 10.66.251.71 with SMTP id zi7mr5676492pac.153.1361559053702; Fri, 22 Feb 2013 10:50:53 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Fri, 22 Feb 2013 11:50:13 -0700 Subject: Re: Number validation issue To: Python Content-Type: text/plain; charset=ISO-8859-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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361559056 news.xs4all.nl 6863 [2001:888:2000:d::a6]:57303 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39607 On Fri, Feb 22, 2013 at 11:27 AM, Morten Engvoldsen wrote: > Hi, > Just to make it more clear: I am looking for how to generate the weight in : > 1, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7.. format for any > length of number instead of > > weights = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2, 1] > > only for fixed digit. > > My below code can check only for 9 digit, so if we provide a number of more > than 9 digit, it is not able to check that number. Hope, this makes clear > what i am looking for... It sounds like you probably should generate the list of weights at run-time rather than hard-coding it as a literal. Have you tried this?