Is it possible to implement a Python for range loop without an iterator variable? -
Is it possible to do the following without i ?
(some_number) for something in the category: # do something If you want to make N sum of some time and do not need an iterator is.
away from the top of my head, no.
I think that whatever you can do is something like this: i variable.
Here is the option to use the _ variable, which in fact, this is just another variable.
for range (n): do_something () Note that _ is assigned to the end result which An interactive dragon returned to session:
& gt; & Gt; & Gt; 1 + 2 3 & gt; & Gt; & Gt; _ 3 For this reason, I will not use it in this way, I am unaware of any of the words mentioned by Ryan, it can mess up your interpreter.
& gt; & Gt; & Gt; For Xchange (10) _: pass ... & gt; & Gt; & Gt; _ 9 & gt; & Gt; & Gt; 1 + 2 3 & gt; & Gt; & Gt; _ 9 And accordingly, this is an acceptable variable name:
Identifier: = (letter | "_") (letter | digit | _ ") *
Comments
Post a Comment