samedi 2 mai 2015

What is this piece of code doing, python

I am self learning python and I was doing an exercise, the solution to which was posted in this thread. Could anyone translate into english what this piece of code means? When I learned if statements I never came across this syntax.

 consonants = 'bcdfghjklmnpqrstvwxz'
 return ''.join(l + 'o' + l if l in consonants else l for l in s)

Aucun commentaire:

Enregistrer un commentaire