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


Groups > comp.lang.python > #39606

Re: Number validation issue

Date 2013-02-22 13:45 -0500
From Dave Angel <davea@davea.name>
Subject Re: Number validation issue
References (2 earlier) <CAO+9iGc5bmp9iNveDQ7Bc_LcDDTX6o0rZdr8vHi1aNxYm6go5Q@mail.gmail.com> <CAJ2vgs76po_3JiuqGtLH3b=bP-U1TW-mYYtkxeU-bbx7Z2oHhw@mail.gmail.com> <CAJ2vgs4YvQ+RcKMjEnSimRE3pv3QYbuHuSeHfnU703w1QJr5Ew@mail.gmail.com> <CAJ2vgs5oX0Oxt++K8v8qHdB46ewpoLKQ9QxQX5P3u_NvypFM7g@mail.gmail.com> <CAJ2vgs7yy27HhidfKCkGbqmBUtfB_dx0s_m9xK8x-ETFKjJd+Q@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2295.1361558753.2939.python-list@python.org> (permalink)

Show all headers | View raw


On 02/22/2013 01:27 PM, 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...
>
You keep top-posting, so we keep losing the context.

zip() stops at the shorter of the two iterables.  And itertools.cycle() 
will repeat a list infinitely.  The two of them should be able to solve 
your problem.


-- 
DaveA

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


Thread

Re: Number validation issue Dave Angel <davea@davea.name> - 2013-02-22 13:45 -0500

csiph-web