Re: Number validation issue

Discussion in 'Python' started by Dave Angel, Feb 22, 2013.

  1. Dave Angel

    Dave Angel Guest

    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
     
    Dave Angel, Feb 22, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Morten Engvoldsen

    Number validation issue

    Morten Engvoldsen, Feb 22, 2013, in forum: Python
    Replies:
    0
    Views:
    89
    Morten Engvoldsen
    Feb 22, 2013
  2. Alec Taylor

    Re: Number validation issue

    Alec Taylor, Feb 22, 2013, in forum: Python
    Replies:
    0
    Views:
    101
    Alec Taylor
    Feb 22, 2013
  3. Alec Taylor

    Re: Number validation issue

    Alec Taylor, Feb 22, 2013, in forum: Python
    Replies:
    0
    Views:
    77
    Alec Taylor
    Feb 22, 2013
  4. Morten Engvoldsen

    Re: Number validation issue

    Morten Engvoldsen, Feb 22, 2013, in forum: Python
    Replies:
    0
    Views:
    93
    Morten Engvoldsen
    Feb 22, 2013
  5. Morten Engvoldsen

    Re: Number validation issue

    Morten Engvoldsen, Feb 22, 2013, in forum: Python
    Replies:
    0
    Views:
    94
    Morten Engvoldsen
    Feb 22, 2013
Loading...

Share This Page