Question: PYTHON QUESTION Write a program that reads in a word entered by the user and checks whether: the word has at least 8 characters, starts

PYTHON QUESTION

Write a program that reads in a word entered by the user and checks whether:

  • the word has at least 8 characters,

  • starts with a vowel,

  • has alternating vowels and consonants, and

  • the consonants are in increasing alphabetical order. Note that you can check letters for alphabetical order using <. For example:

    >>> a < b True >>> z < b False 

    Your program should work for words entered the upper or lower case, and must use a single functionis_alternating(word) that returns True if the word has the above pattern and False otherwise. Hint: Remember to write a loop that goes through each letter and check for the necessary conditions. Using indexing is important here as you need to compare letters in different positions.

    Here is an example run of this program:

    Enter a word => eLimiNate eLimiNate The word 'eliminate' is alternating 
Enter a word => ageneses ageneses The word 'ageneses' is not alternating 
Enter a word => ADAGE ADAGE The word 'adage' is not alternating 

The word eliminate has this alternating pattern since we have that: 'l' < 'm' < 'n' < 't'.

The word adage is not long enough, ageneses has two consonants that are identical and as a result not in strictly increasing alphabetical ordering.

Here is another hint that will help: Given a letter stored in the variable x, the boolean expression:

x in 'aeiou'

is True if and only if x is a lowercase vowel.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!