notebook.community
Edit and run
This program will count the number of i's in the input word.
In [1]: word = input("Enter a word: ") count = 0 for letter in word: if letter== 'i': count = count + 1 print("There are %d i's in the word %s" % (count,word))
word = input("Enter a word: ") count = 0 for letter in word: if letter== 'i': count = count + 1 print("There are %d i's in the word %s" % (count,word))
Enter a word: mississippi There are 4 i's in the word mississippi
In [ ]: