I need to check if every string in a list is in titlecase. If yes return True - if not return False. I have written the following:
word_list=["ABC", "abc", "Abc"]
def all_title_case(word_list):
for word in word_list:
if not word.istitle():
return False
else:
return True
print(all_title_case(word_list))
My problem is that it seems that the loops stops after the first string (which i guess is because of return?)
How could i make it go over the whole list?
*I am new to python
thanks a lot!
Aucun commentaire:
Enregistrer un commentaire