I was playing around with list comprehension but I get an syntax error with the else statement
doctor = ['house', 'cuddy', 'chase', 'thirteen', 'wilson']
first = [doc[0] for doc in doctor if doc[0] == 'h' else doc[3]]
What's the problem with this?
Aucun commentaire:
Enregistrer un commentaire