In this example we will show how to count the number of vowel letters in a string.
Source Code
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
str = input("Please input the string: ")
n = 0
for x in str:
if x == "A" or x == "E" or x == "I" or x == "O" or x == "U" or x == "a" or x == "e" or x == "i" or x == "o" or x == "u":
n += 1
print("The number of vowels is: ", n)
Output:
Please input the string: appale
The number of vowels is: 3