mardi 10 décembre 2019

Ternary if condition in Python [closed]

Hi this is more than a problem just a question:

Why would this not work and how to fix the ternary condition? :

     def removeUnderScore(string, remove=None):
        newString = ''
            newString += ' ' if char == remove else newString += char
        return newString


print (removeUnderScore('test', remove='e')

thank you

Aucun commentaire:

Enregistrer un commentaire