dimanche 5 mars 2017

For Loop-If conditional statement

I have some codeBlock that read:

for x in someDataStructure:
   if x.someMethod(Singleparam):
      var.add((y, x.someOtherMethod(y)))

how can i convert it to the equivalent form of

var.add((y , (x.someOtherMethod(y) in x for x in someDataStructure if x.someMethod(singleParam))))

this code line does not work! :( also what's the same of this style of loop?

I am fairly new in python

Aucun commentaire:

Enregistrer un commentaire