You need to create a program that analyzes a given word character by character. For each character, the program should determine whether it is a vowel or a consonant. The program should stop processing as soon as it encounters a non-alphabetic character.
1. **Input Handling**:
- The program starts by reading a word from the user input.
2. **Processing Each Character**:
- It then iterates through each character in the word.
3. **Character Check**:
- For each character, the program first checks if it is an alphabetic character. If it is not, the program stops further processing.
- If the character is alphabetic, it checks whether it is a vowel (i.e., one of the characters in the string `'aeiou'`).
- Based on this check, it prints either "vowel" if the character is a vowel, or "consonant" if it is not.
This approach processes a word to classify each character as either a vowel or a consonant, stopping when encountering a non-alphabetic character. It provides a clear and straightforward way to analyze the types of characters in a given input.
No comments:
Post a Comment