vendredi 30 novembre 2018

Python - can I repeat if else in a for loop?

Could I repeat if .. else statement in a for loop?

def function_example():
for i in range(len(alist)):
 if ..
   do something
 else
   pass 
 if ...
  do something
 else
   pass

I actually tried this, but it wouldn't work.

Aucun commentaire:

Enregistrer un commentaire