Nov-15-2019, 03:12 PM
I'm trying to count the number of words in a sentence that include "o" or "e." Why does this count every word?
player_str = "the best player in the world was nomar garciappara" #Enter your code below num_o_or_e = 0 s = player_str.split() print(player_str) print(s) for word in s: if 'o' or 'e' in word: print(word) num_o_or_e = num_o_or_e + 1 print('The number of words with an o or e in specified sentence is',num_o_or_e)