[Solved] Applying a for loop to a conditional statement [closed]


You cannot escape python’s indentation. What you can do is put your block of code in a function and the you only need to indent the single line with the function call.
Instead of

if condition:
   # code
   # code 
   # code...

Have a function

def my_code_block():
   if condition:
       # code
       # code 
       # code...

And then, in the caller function

for i in xrange(10):
    my_code_block( ... )

You only indent one line…

2

solved Applying a for loop to a conditional statement [closed]