conditions = [1, 2, 3, 4]
values = [1, 2, 3, 3]
[print("YAY") for c,v in zip(conditions,values) if c==v]
This works but if I add an else statement as in the following example it raises a syntax error:
[print("YAY") for c,v in zip(conditions,values) if c==v else print("NAY")]
why is it forbidden to do so? would have made full of sense if it had worked (at least for me)
Aucun commentaire:
Enregistrer un commentaire