Question: A Python program that checks if the input string is a palindrome containing at least 2 vowels You may use either a for or a

A Python program that checks if the input string is a palindrome containing at least 2 vowels 

You may use either a for or a while loop in this solution

You can create the following:

a. a function to input the string that is at least 6 characters long and contains only letters of the alphabet. Convert the string to lowercase after input. Return the string to the main

b. pass the string to a function that checks if the string is a palindrome and returns a bool back to main. If the return value is false, a message should be displayed that the string was not a palindrome and the program should terminate. You can either use the exit function or use a decision structure.

c. if the return value from b. is true, pass the string to another function that counts the number of vowels in the string. The function should return the count to main

d. When the count of vowels is returned to main, check if the count is at least 2. If the count is 2 or more, display that the string is a palindrome with at least two vowels. If not, display a sentence that the string is a palindrome that does not have at least 2 vowels. 

The following are acceptable input constraints and must be handled in your logic. Everything else must be rejected by the logic.

  • string input that is at least 6 characters long
  • the input must be made up of only letters of the alphabet (A-Z or a-z)

Examples:

Enter a string:  race car

race car is not a palindrome

Enter a string:  tacocat

tacocat is a palindrome with at least 2 vowels

Enter a string: mom

mom is a palindrome that has less than 2 vowels

 

Step by Step Solution

3.46 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

def inputstring userinput inputEnter a string lower if use... View full answer

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 Programming Questions!