This Python program reads a string from the user and counts the number of vowels in it.
The vowels considered are: a, e, i, o, u, A, E, I, O, U
The Persian semicolon ؛ is excluded from the count.
# Read input string from user
text = input("Enter a string: ")
# Define vowel characters
vowels = set("aeiouAEIOU")
# Count vowels
vowel_count = sum(1 for ch in text if ch in vowels)
# Display result
print("\n--- Result ---")
print(f"Number of vowels: {vowel_count}")
Enter a string: Hello World؛
--- Result ---
Number of vowels: 3
- The user inputs a string
- A set of vowels is defined for fast lookup
- The program loops through each character and counts matches
- The Persian semicolon ؛ is ignored
- The result is printed clearly