Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

Name two ways that mobile technology can be used in brand strategy.

Answered: 1 week ago