Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Number validation issue

Reply
Thread Tools

Re: Number validation issue

 
 
Dave Angel
Guest
Posts: n/a
 
      02-22-2013
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Number validation issue Morten Engvoldsen Python 0 02-22-2013 04:40 PM
Re: Number validation issue Morten Engvoldsen Python 0 02-22-2013 04:32 PM
Re: Number validation issue Alec Taylor Python 0 02-22-2013 03:33 PM
Re: Number validation issue Alec Taylor Python 0 02-22-2013 03:30 PM
Number validation issue Morten Engvoldsen Python 0 02-22-2013 03:09 PM



Advertisments