Gandalf wrote:
On Oct 18, 12:39 pm, Duncan Booth <[EMAIL PROTECTED]>
wrote:
Gandalf <[EMAIL PROTECTED]> wrote:
how can I do width python a normal for loop width tree conditions like
for example :
for x=1;x<=100;x+x:
print x
What you wrote would appear to be an infinite loop so I'll assume you meant
to assign something to x each time round the loop as well. The simple
Python translation of what I think you meant would be:
x = 1
while x <= 100:
print x
x += x
..
I was hopping to describe it with only one command. most of the
languages I know use this.
It seems weird to me their is no such thing in python. it's not that I
can't fined a solution it's all about saving code
You'd not save code, but only lines (and clearness). You'd also
need more (non-space) characters
Python saves confusion and arbitrariness => you'll usually code
faster, because you don't think so much about voluptuous
multimulti..possibilites, not worth the play: one-ness of mind
If insistent, you could sometimes save lines like this ;-)
x=1
while x<=100: print x; x+=x
Robert
--
http://mail.python.org/mailman/listinfo/python-list