Nobody於 2012年8月7日星期二UTC+8下午11時32分55秒寫道:
> On Mon, 06 Aug 2012 21:02:33 -0700, Larry Hudson wrote:
>
>
>
> >> for i in range(N,N+100):
>
> >> for j in range(M,M+100):
>
> >> do_something(i % 100 ,j % 100)
>
> >>
>
> >> Emile
>
> >
>
> > How about...
>
> >
>
Nobody於 2012年8月7日星期二UTC+8下午11時32分55秒寫道:
> On Mon, 06 Aug 2012 21:02:33 -0700, Larry Hudson wrote:
>
>
>
> >> for i in range(N,N+100):
>
> >> for j in range(M,M+100):
>
> >> do_something(i % 100 ,j % 100)
>
> >>
>
> >> Emile
>
> >
>
> > How about...
>
> >
>
Nobody於 2012年8月7日星期二UTC+8下午11時32分55秒寫道:
> On Mon, 06 Aug 2012 21:02:33 -0700, Larry Hudson wrote:
>
>
>
> >> for i in range(N,N+100):
>
> >> for j in range(M,M+100):
>
> >> do_something(i % 100 ,j % 100)
>
> >>
>
> >> Emile
>
> >
>
> > How about...
>
> >
>
Nobody於 2012年8月7日星期二UTC+8下午11時32分55秒寫道:
> On Mon, 06 Aug 2012 21:02:33 -0700, Larry Hudson wrote:
>
>
>
> >> for i in range(N,N+100):
>
> >> for j in range(M,M+100):
>
> >> do_something(i % 100 ,j % 100)
>
> >>
>
> >> Emile
>
> >
>
> > How about...
>
> >
>
On Mon, 06 Aug 2012 21:02:33 -0700, Larry Hudson wrote:
>> for i in range(N,N+100):
>> for j in range(M,M+100):
>> do_something(i % 100 ,j % 100)
>>
>> Emile
>
> How about...
>
> for i in range(100):
> for j in range(100):
> do_something((i + N) % 100,
On 08/06/2012 11:11 AM, Emile van Sebille wrote:
for i in range(N,N+100):
for j in range(M,M+100):
do_something(i % 100 ,j % 100)
Emile
How about...
for i in range(100):
for j in range(100):
do_something((i + N) % 100, (j + M) % 100)
-=- La
On Mon, 06 Aug 2012 19:16:45 +0200, Tom P wrote:
>> def my_generator():
>> yield 9
>> yield 100
>> for i in range(200, 250):
>> yield i
>> yield 5
>>
>>
> Thanks, I'll look at that but I think it just moves the clunkiness from
> one place in the code to another.
And i
On 6 August 2012 16:52, Tom P wrote:
> consider a nested loop algorithm -
>
> for i in range(100):
> for j in range(100):
> do_something(i,j)
>
> Now, suppose I don't want to use i = 0 and j = 0 as initial values, but some
> other values i = N and j = M, and I want to iterate through a
On 8/6/2012 12:22 PM Grant Edwards said...
On 2012-08-06, Tom P wrote:
ah, that looks good - I guess it works in 2.x as well?
I don't know. Let me test that for you...
Yes, it works in 2.x as well.
:)
And from the docs, all the way back to 2.3!
9.7. itertools Functions creati
On 2012-08-06, Tom P wrote:
no, I meant something else ..
j runs through range(M, 100) and then range(0,M), and i runs through
range(N,100) and then range(0,N)
>>>
>>> In 2.x:
>>>
>>> for i in range(M,100)+range(0,M):
>>> for j in range(N,100)+range(0,N):
>>>
On 08/06/2012 08:29 PM, Grant Edwards wrote:
On 2012-08-06, Grant Edwards wrote:
On 2012-08-06, Tom P wrote:
On 08/06/2012 06:18 PM, Nobody wrote:
On Mon, 06 Aug 2012 17:52:31 +0200, Tom P wrote:
consider a nested loop algorithm -
for i in range(100):
for j in range(100):
On 2012-08-06, Tom P wrote:
> On 08/06/2012 06:18 PM, Nobody wrote:
>> On Mon, 06 Aug 2012 17:52:31 +0200, Tom P wrote:
>>
>>> consider a nested loop algorithm -
>>>
>>> for i in range(100):
>>> for j in range(100):
>>> do_something(i,j)
>>>
>>> Now, suppose I don't want to use i =
On 2012-08-06, Grant Edwards wrote:
> On 2012-08-06, Tom P wrote:
>> On 08/06/2012 06:18 PM, Nobody wrote:
>>> On Mon, 06 Aug 2012 17:52:31 +0200, Tom P wrote:
>>>
consider a nested loop algorithm -
for i in range(100):
for j in range(100):
do_something(i,
* Tom P wrote:
> consider a nested loop algorithm -
>
> for i in range(100):
> for j in range(100):
> do_something(i,j)
>
> Now, suppose I don't want to use i = 0 and j = 0 as initial values, but
> some other values i = N and j = M, and I want to iterate through all
> 10,000 value
On 8/6/2012 10:14 AM Tom P said...
On 08/06/2012 06:18 PM, Nobody wrote:
On Mon, 06 Aug 2012 17:52:31 +0200, Tom P wrote:
consider a nested loop algorithm -
for i in range(100):
for j in range(100):
do_something(i,j)
Now, suppose I don't want to use i = 0 and j = 0 as initial
On 6 August 2012 18:14, Tom P wrote:
> On 08/06/2012 06:18 PM, Nobody wrote:
>
>> On Mon, 06 Aug 2012 17:52:31 +0200, Tom P wrote:
>>
>> consider a nested loop algorithm -
>>>
>>> for i in range(100):
>>> for j in range(100):
>>> do_something(i,j)
>>>
>>> Now, suppose I don't wan
On 08/06/2012 06:03 PM, John Gordon wrote:
In Tom P writes:
consider a nested loop algorithm -
for i in range(100):
for j in range(100):
do_something(i,j)
Now, suppose I don't want to use i = 0 and j = 0 as initial values, but
some other values i = N and j = M, and I wan
On 08/06/2012 06:18 PM, Nobody wrote:
On Mon, 06 Aug 2012 17:52:31 +0200, Tom P wrote:
consider a nested loop algorithm -
for i in range(100):
for j in range(100):
do_something(i,j)
Now, suppose I don't want to use i = 0 and j = 0 as initial values, but
some other values i = N
On Mon, 06 Aug 2012 17:52:31 +0200, Tom P wrote:
> consider a nested loop algorithm -
>
> for i in range(100):
> for j in range(100):
> do_something(i,j)
>
> Now, suppose I don't want to use i = 0 and j = 0 as initial values, but
> some other values i = N and j = M, and I want to
The function range can be called with more than one argument. For example:
for i in range(N, N + 10):
for j in range(M, M + 100):
do_something(i, j)
You can also call range with 3 arguments, if want a step size different
to 1:
for k in range(2, 11, 3):
print(k)
2
5
8
Hope th
In Tom P writes:
> consider a nested loop algorithm -
> for i in range(100):
> for j in range(100):
> do_something(i,j)
> Now, suppose I don't want to use i = 0 and j = 0 as initial values, but
> some other values i = N and j = M, and I want to iterate through all
> 10,000 valu
Tom P wrote:
consider a nested loop algorithm -
for i in range(100):
for j in range(100):
do_something(i,j)
Now, suppose I don't want to use i = 0 and j = 0 as initial values, but
some other values i = N and j = M, and I want to iterate through all
10,000 values in sequence - is t
On 6 August 2012 16:52, Tom P wrote:
> consider a nested loop algorithm -
>
> for i in range(100):
> for j in range(100):
> do_something(i,j)
>
> Now, suppose I don't want to use i = 0 and j = 0 as initial values, but
> some other values i = N and j = M, and I want to iterate through
Are you familiar with the itertools module?
itertools.product is designed for this purpose:
http://docs.python.org/library/itertools#itertools.product
Oscar.
On 6 August 2012 16:52, Tom P wrote:
> consider a nested loop algorithm -
>
> for i in range(100):
> for j in range(100):
>
consider a nested loop algorithm -
for i in range(100):
for j in range(100):
do_something(i,j)
Now, suppose I don't want to use i = 0 and j = 0 as initial values, but
some other values i = N and j = M, and I want to iterate through all
10,000 values in sequence - is there a neat py
Thanks for the help!
Using while True helps alot!
Paulo Repreza
--
http://mail.python.org/mailman/listinfo/python-list
Paulo Repreza wrote:
> Greetings,
>
> I'm having problems with a little script that I'm trying to finish, I
> don't know if I'm in the right track but I know somebody is going to
> help me.
>
> The script:
>
> # Import modules random for function randint
>
> import random
>
> # Generating a co
Jean-Michel Pichavant writes:
> Paulo Repreza wrote:
>> Greetings,
>>
>> I'm having problems with a little script that I'm trying to finish,
>> I don't know if I'm in the right track but I know somebody is going
>> to help me.
>>
>> The script:
>>
>> # Import modules random for function randint
>
Jean-Michel Pichavant a écrit :
Paulo Repreza wrote:
Greetings,
I'm having problems with a little script that I'm trying to finish, I
don't know if I'm in the right track but I know somebody is going to
help me.
(snip - problem already addressed by Jean-Michel...)
while var != ranum:
Paulo Repreza wrote:
Greetings,
I'm having problems with a little script that I'm trying to finish, I
don't know if I'm in the right track but I know somebody is going to
help me.
The script:
# Import modules random for function randint
import random
# Generating a constant.
var = 65
#
Greetings,
I'm having problems with a little script that I'm trying to finish, I don't
know if I'm in the right track but I know somebody is going to help me.
The script:
# Import modules random for function randint
import random
# Generating a constant.
var = 65
# Generating a random number
On Aug 13, 8:46 am, Sion Arrowsmith <[EMAIL PROTECTED]>
wrote:
> Dave <[EMAIL PROTECTED]> wrote:
> >hitNum = 0
> >stopCnt = 6 + hitNum
> >offSet = 5
>
> >for i in range(0,10,1):
>
> The step argument to range defaults to 1: it's tidier to omit it.
> Similarly, the start argument defaults to 0, so
Dave <[EMAIL PROTECTED]> wrote:
>hitNum = 0
>stopCnt = 6 + hitNum
>offSet = 5
>
>for i in range(0,10,1):
The step argument to range defaults to 1: it's tidier to omit it.
Similarly, the start argument defaults to 0, so you can drop that too.
for i in range(10):
> for x in range(hitNum,len
Dave wrote:
arrrggg, now I feel really dumb..
hitNum = 0
stopCnt = 6 + hitNum
offSet = 5
for i in range(0,10,1):
for x in range(hitNum,len(inLst), 1):
print hitNum, stopCnt
if x == stopCnt: break
hitLst.append(inLst[x])
hitNum +=o
Dave napisał(a):
> Hey there, having a bit of problem iterating through lists before i go
> on any further, here is
> a snip of the script.
> --
> d = "a1 b1 c1 d1 e1 a2 b2 c2 d2 e2 a3 b3 c3 d3 e3 a4 b4 c4 d4 e4 a5 b5
> c5 d5 e5"
> inLst = d.split()
> hitLst = []
>
> hitNum = 0
> stopCnt = 6 + hitN
arrrggg, now I feel really dumb..
hitNum = 0
stopCnt = 6 + hitNum
offSet = 5
for i in range(0,10,1):
for x in range(hitNum,len(inLst), 1):
print hitNum, stopCnt
if x == stopCnt: break
hitLst.append(inLst[x])
hitNum +=offSet
On Aug 13, 12:35 am, Larry Bates <[EMAIL PROTECTED]> wrote:
> Dave wrote:
> > Hey there, having a bit of problem iterating through lists before i go
> > on any further, here is
> > a snip of the script.
> > --
> > d = "a1 b1 c1 d1 e1 a2 b2 c2 d2 e2 a3 b3 c3 d3 e3 a4 b4 c4 d4 e4 a5 b5
> > c5 d5 e5"
Dave wrote:
Hey there, having a bit of problem iterating through lists before i go
on any further, here is
a snip of the script.
--
d = "a1 b1 c1 d1 e1 a2 b2 c2 d2 e2 a3 b3 c3 d3 e3 a4 b4 c4 d4 e4 a5 b5
c5 d5 e5"
inLst = d.split()
hitLst = []
hitNum = 0
stopCnt = 6 + hitNum
for i in range(hitNu
Hey there, having a bit of problem iterating through lists before i go
on any further, here is
a snip of the script.
--
d = "a1 b1 c1 d1 e1 a2 b2 c2 d2 e2 a3 b3 c3 d3 e3 a4 b4 c4 d4 e4 a5 b5
c5 d5 e5"
inLst = d.split()
hitLst = []
hitNum = 0
stopCnt = 6 + hitNum
for i in range(hitNum,len(inLst),
Hi,
First ;-) I don't know Tk or plot, but from looking at your code I see you want
to plot
a line a minute long, after that, all dots are drawn to the screen. You call
>self.graph.addSet(x,y)
My guess is that you have to explicitly draw to the screen using same call from
graph
Hi, First, I want to thank those who responded to my question about "the plot module" yesterday. I realize now that the question could have been vague. There is a plot module, simply called "plot," that I am using, and I guess it is not a very widely circulated plotting utility. Anyway, I
41 matches
Mail list logo